Skip to main content

apa102_gpiod

A python library for accessing APA102 addressable LEDs using libgpiod, a library used to access the userspace gpio character device.

Useful for situations where you need to drive LEDs attached to non-SPI capable I/O lines, or when the in-kernel spi-gpio driver is not available (example: Pimoroni Blinkt on the default kernels from mainstream distributions)

The usage of this library is probably frowned upon by virture of linux/Documentation/driver-api/gpio/drivers-on-gpio.rst, so go and pressure the Raspberry Pi kernel devs to include spi-gpio, so we wouldn't have to resort to custom out-of-tree kernels or evil bitbanging in userspace!

Prerequisites

  • Linux Kernel >= 4.8
  • libgpiod >= 039b301b173c78664775d1ea93493825ef80c9d4
  • Python >= 3.6

Installation

  • libgpiod
    • https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
    • Remember to --enable-bindings-python when configuring.
  • apa102_gpiod
    • pip install apa102_gpiod

Tests

  • Tests can be found in the test directory.
    • Only unit tests are present now, more tests welcome.
  • Use your favourite test runner to run the tests, or:
    • pip install setuptools
    • pip install pytest
    • python setup.py test

Performance

Since we're accessing the GPIOs through the character device and not through some memory-mapped magic, performance is guaranteed to be lower. Here are some test results:

Device Software Achieved data rate (kByte/s)
RPI3 B Arch Linux ARM Linux 4.14.37 13962

Caveats

  • No clock rate control is implemented, since the achieved data rates are way below the maximum data rates supported by the APA102.
    • File an issue report if needed.

Examples

See the examples directory.

Licensing

This project is licensed under the MIT License. See LICENSE.txt for more details.

Metadata

Release files for apa102-gpiod 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apa102-gpiod 0.3.0
File Size Uploaded
apa102_gpiod-0.3.0.tar.gz 5.8 kB Details

Release files / apa102_gpiod-0.3.0.tar.gz

Download URL apa102_gpiod-0.3.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
64f1ce5744813ab48f8659aec5294d2d9c5d2ddc48dc7eee38d7ca82e6b07775
BLAKE2b-256 checksum
How to use checksums
8d93541d43e39d0eca8c38cbb268e36576592ad15eba707e55faafe7c52dd291
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page