-
Notifications
You must be signed in to change notification settings - Fork 1.1k
add pico_status_led #2501
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
base: develop
Are you sure you want to change the base?
add pico_status_led #2501
Conversation
I think the color setting should be orthogonal to the On/Off and the color method should not mention WS2812 in their name - they should probably (and all the methods really) have a bool which says whether they do anything (so you can still use the library with no LEDs at all) I'm not quite sure about the color APIs right now - somewhat leaning towards uint32_t so you can read, and allow r,g,b or w,r,g,b methods - maybe make it a #define what WRGB LEDs do when you set r,g,b (either 0 for WRGB or auto set) |
Ah right. I was thinking you'd use the ws2812 as the blinking led. But just having a function to set the ws2812 colour might be better - as most boards seem to have both a simple led and a ws2812 led. |
There are definitely several boards with only a WS2812 and no normal LED though. EDIT: Hmmm, so given that this is a "status LED" library and not a "WS2812 library", and we're basically using the ws2812 as though it were a normal LED; perhaps it makes sense to only have the "on" colour configurable, and always have the "off colour" as blank? 🤔 Because otherwise it might not be clear that e.g. "red" is "on" and "turquoise" is "off"! 🌈 |
I'll get rid of the on off thing and just have a method that sets the RGB of a colour status led. |
IMHO being able to simply turn on/off an RGB LED would mean that a board with an RGB LED (using this status_led library) could be used identically (after a recompile of course) to a board with a normal LED? (e.g. the canonical "status-LED-blink" example) |
But most boards are configured with both. Who's to say that you shouldn't be able to control both individually? |
I'm not saying that you shouldn't be able to control both LEDs individually, I guess I was just kinda expecting a So, entirely IMVHO:
That way any example-code that's using the |
Let's keep it simple. If @kilograham disagrees we can change it |
074d424
to
fcada13
Compare
The cyw43-driver enables LwIP if CYW43_LWIP is not defined. Allow LwIP to be disabled by default if CYW43_LWIP is not defined so we can use the driver to access the led without needing to link to LwIP. Add CYW43_LWIP_DEFAULT to enable this.
This is somewhat similar to what i was expecting.
Sorry, i haven't given a lot of though yet to how i would like this to look |
Functions for turning a binary led on and off and setting value of a colour status led. Fixes raspberrypi#188
* \param True if the status led could be set, otherwise false | ||
*/ | ||
static inline bool pico_status_led_set(bool led_on) { | ||
#if defined PICO_DEFAULT_LED_PIN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I tihnk this method should support WS2812 leds too - it can call into a method in that case
- I think there should be a PICO_STATUS_LED config to pick WS2812 over LED for status LED if both are present
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What colour would you use for on and off? Would it be onfigurable at build time? Would it be configurable at run time?
looking nice - one comment in code |
Add a status led library to make adapting to a "normal" led and the cyw43 led a bit easier.
Bonus support for ws2812 leds.