Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unclegrumpy/atomvm_led_strip
An AtomVM Erlang driver for SPI addressable LEDs
https://github.com/unclegrumpy/atomvm_led_strip
Last synced: 5 days ago
JSON representation
An AtomVM Erlang driver for SPI addressable LEDs
- Host: GitHub
- URL: https://github.com/unclegrumpy/atomvm_led_strip
- Owner: UncleGrumpy
- License: apache-2.0
- Created: 2024-04-22T23:40:27.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-04-29T15:15:01.000Z (7 months ago)
- Last Synced: 2024-04-29T16:35:45.564Z (7 months ago)
- Language: Erlang
- Homepage:
- Size: 43.9 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# atomvm_led_strip
Welcome to the atomvm_led_strip AtomVM AP102 library.
This is an AtomVM native spi driver for the AP102 RGB LED written is pure Erlang. This driver has been tested on the ESP32 platform, but should work on other microcontrollers, if an AtomVM SPI driver interface that supports `spi:write/3` transactions is added in the future.
Currently the driver only supports a single dot. This is all I have available to test on, but supoport is planned for strips and matrix in the near future.
The AP102 uses just the SPI `sclk` and `mosi` pins on the SPI bus, and does not use a `cs` pin. This should not pose a problem to other peripherals on the same bus, as long as they do use a `cs` pin, but it does mean that it is remotely possible that data transmissions intended for other peripherals _could_ cause a color change in the AP102 LED(s). This is fairly unlikely, but not impossible. The AP102 looks for a sequence of 32 (or more) `0` bits in a row, followed by 3 bits in a row of `1` (the next five bits set the brightness of the first LED), the next 24 bits are the color value of the first LED, additionally, any number of 32 bit LED (brightness + color) data packets may be included, followed by 32 bits of `1` to signal the end of the transmission. If you are using a peripheral that might reqire similarly constructed SPI transmissions you should consider putting it on a different SPI bus, or accept that the LED may occasionally exhibit unexpected behavior.
See the examples folder for how use the driver use the driver.