drivers/led: add LEDX_IS_PRESENT defines #20637
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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