boards/common/native: expose mock saul GPIO pins#22234
boards/common/native: expose mock saul GPIO pins#22234basilfx wants to merge 1 commit intoRIOT-OS:masterfrom
Conversation
When periph_gpio_mock is included, expose two LEDs via saul_gpio for testing purposes. This does not work with periph_gpio_linux because the hard-coded pins are more dynamic for the native board.
e4b2127 to
b76fa82
Compare
Would it make sense to add a check/warning to a Makefile for that case? The new Pseudomodule has to be added to the Also I wonder if it has to be added here as well? RIOT/makefiles/features_modules.inc.mk Lines 128 to 134 in fdb532a |
Not sure. It will work, but the pin mapping will be incorrect, which leads to segfaults (I noticed). This simply enables a feature if "the stars align".
This is not a new pseudomodule, so then it is not necessary, right? |
I meant something like "Warning: you're using periph_gpio_linux together with periph_gpio_mock, which can lead to unforseen side effects!" while compiling.
You are right, I did not realize that this is already present. |
I'll check that. I believe there is a way to define conflicting features, and I presume it will not even compile, since both implement periph_gpio. |
Contribution description
When
periph_gpio_mockis included, expose two LEDs viasaul_gpiofor testing purposes. It is not enabled by default, so its use is limited. However, I do have a use-case that is only useful if there is something exposed via SAUL.This does not work with
periph_gpio_linuxbecause the hard-coded pins are more dynamic for the native board.Native defines macros for LED0 and LED1, and has the
native_driversmodule for providing some console feedback. This change completely ignores that, just likeperiph_gpio_mockalready does.Testing procedure
Compile using
USEMODULE=periph_gpio_mock BOARD=native make -C examples/basic/default.The run the example, and use the
saulcommand:Issues/PRs references
None
Declaration of AI-Tools / LLMs usage:
None