-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Native SPI RGB LED component #5288
Conversation
This is kinda a duplicate of #5101 which does need work to use SPIDevice like this PR does, but implements a generic SPI led strip driver which would be preferred over having multiple specific ones like this PR implements. Perhaps somehow a merge of the two PRs is in order? |
Well I don't have any of the other LEDs on hand to test with, however looking at the datasheet for the SK9822 and the HD107 it appears the code I already wrote will work with them, as they have the identical frame format and BGR order. So maybe all that's needed is a name change (maybe spi_rgb_led) and some extra documentation. I don't want to make it some kind of umbrella component that tries to do too much. Keeping it simple makes keeping it working easy. IOW I would resist adding the one-wire LED protocol support which requires quite different code. |
The APA107 is a 1-wire chip, so not SPI compatible. The HD108 is SPI but has 16 bit data, so that's a possibility to add, but I'd prefer to do that later when I have some to test with. They're new and more expensive so probably not widely in use yet. So right now it seems the APA102, APA102C, HD107 and SK9822 will work with my code and they are the main SPI type RGB leds available. |
FWIW, I think the APA107 is also a 2-wire interface with clock and data lines -- at least, everything I'm finding on it right now seems to indicate this. 😇 |
I found two conflicting datasheets for APA107. Maybe there are two different chips from different manufacturers. https://www.rose-lighting.com/wp-content/uploads/sites/53/2019/10/apa107-LED.pdf |
Anyway, the 2 wire APA107 should work just fine with this component. I renamed it to |
|
What does this implement/fix?
Types of changes
This new component supports the APA102 and similar SPI addressable RGB LEDs. While there is support for these LEDs in other components, these rely on external libraries supporting multiple different chip types and don't work with ESP-IDF.
This component supports only the SPI (two wire) LED interface and leverages the existing ESPHome
spi
component so works on both Arduino and ESP-IDF platforms, is lightweight and performant. It has only been tested on ESP32 but should work with any platform supported by ESPHome that implements SPI.Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#3147
Test Environment
Example entry for
config.yaml
:Checklist:
tests/
folder).If user exposed functionality or configuration variables are added/changed: