-
Notifications
You must be signed in to change notification settings - Fork 2k
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
boards/common/stm32: clean up LED definitions #18415
Conversation
If I well understand your code You assumed that LED is ON when the port is at HIGH state. I don't know how many boards, but at least old stm32f469i-disco use swap polarity - LOW state ONs the LED - see #18041 for more details. |
Thanks for the pointer. I will add support for inverted LEDs to the common header, so that boards with inverted LEDs just have to toss in an |
Let boards only define the port and pin number of each LEDs. The common definitions in `stm32_leds.h` will provide `LED<x>_ON`, `LED<x>_OFF`, `LED<x>_TOGGLE`, `LED<x>_PIN`, `LED<x>_MASK` and `LED<x>_PORT`. In addition to code de-duplication, this also makes it easier to use LEDs in GPIO LL, which can be beneficial for super low overhead debugging output - e.g. when a bug is timing sensitive and `DEBUG()` would spent to much time for stdio to reproduce a bug.
eaadcff
to
1fd9913
Compare
Should be fixed now. If my regex-fu is not too bad, I should also have tracked down all other STM32 boards that were configured to use inverted LEDs, so that this hopefully does not cause regressions. |
I successfully tested this on the STM32F103 bluepill via |
I checked your PR with |
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.
That's a nice convenience improvement.
6c284c2
to
5e9d3c3
Compare
5e9d3c3
to
db3c51d
Compare
I replaced a few thousands of |
Thx :) |
Contribution description
Let boards only define the port and pin number of each LEDs. The common definitions in
stm32_leds.h
will provideLED<x>_ON
,LED<x>_OFF
,LED<x>_TOGGLE
,LED<x>_PIN
,LED<x>_MASK
andLED<x>_PORT
.In addition to code de-duplication, this also makes it easier to use LEDs in GPIO LL, which can be beneficial for super low overhead debugging output - e.g. when a bug is timing sensitive and
DEBUG()
would spent to much time for stdio to reproduce a bug.Testing procedure
The LED macros should not change to master. Hence, the (except for debug symbols) the binaries generated should not change compared to master.
One could also test if controlling LEDs still works for all the changed boards...
Issues/PRs references
None