-
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
drivers/led: add LEDX_IS_PRESENT defines #20637
Conversation
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.
Looks good to me, but the CI will insist on the documentation.
I do agree that the name is self-documenting, but the CI doesn't have this intuition and will insistent anyway.
Would you mind to squash the two commits into one? |
c10c722
to
a813e97
Compare
Squashed. |
Hmm, automerge didn't seem to work here: There is no job running on Murdock. Let's turn it off and on again. |
Ahh, my fault 😅 |
Thx for your contribution 😄 |
Contribution description
Currently
LEDX_ON
,LEDX_OFF
, etc. are defined in theboard.h
(orboard_common.h
or similar) files. However, various boards could have from 0 to 8 internal LEDs and to write portable code each call ofLEDX_...
should be protected by#ifdef LEDX_...
. Includingled.h
header file resolve this issue and defines emptyLEDX_...
if LED is not present for given board. However, after includingled.h
there is no possibility to check if given board, really posses particular LED.This PR adds
LEDX_IS_PRESENT
define for each presented LED at given board.Testing procedure
This code snippet:
Should show real number of first three LEDs, for example:
in native board.
Issues/PRs references
None