-
Notifications
You must be signed in to change notification settings - Fork 20
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
Configurable LED brightness #3
Comments
In theory I think it should be, currently we use the GPIO LEDs implementation so it is on/off only. I think it'd be nice if the implementation would work with both types and we define PWM LEDs for the supported boards along with brightness setting support. I hadn't looked into it before because it hasn't seemed necessary but I am happy to look into it when I have a chance or have someone else contribute it. |
I tried to fiddle around the code, but I don't understand C and Zephyr very well. 😞 From what I searched the internal LEDs from XIAO can be used with PWM, it is correct? |
I believe so. I see your attempts at main...diegolhambi:zmk-rgbled-widget:main which seems mostly correct but I don't see where you define I think you also want only one pinctrl node If it helps, there is a PWM sample in Zephyr showing the code API and board overlays as well. |
Thanks for the info, you helped a lot! I've been able to make work declaring the I found one bug, soon after powering up the board, all LEDs light up before the |
That's great to hear 😄 Regarding the bad initialization, looking at this it looks like you might want to set |
Setting I removed the "reset" in the |
I think I have made something like what you described. #if IS_ENABLED(CONFIG_PWM)
#define LED_NODE_ID DT_COMPAT_GET_ANY_STATUS_OKAY(pwm_leds)
#else
#define LED_NODE_ID DT_COMPAT_GET_ANY_STATUS_OKAY(gpio_leds)
#endif This will load the correct driver if the board have the PWM enabled. |
Nice! As long as you also gate the brightness setting function calls with the |
I'm going to close this PR because configuring PWM on the nRF activates an additional clock, and there are no effective gains in battery consumption. |
Is it possible to change LED brightness using PWM or something similar?
The text was updated successfully, but these errors were encountered: