I’m working with a Verdin iMX8M Plus on a Verdin development board. I’m working on GPIO initialization, and found your documentation for working with GPIOs using gpiod on TorizonCore.
I’m at the very beginning of this exercise and ran into something peculiar. One of your examples had GPIO initialization:
/* config as output and set a description */
gpiod_line_request_output(output_line, “gpio-test”,
GPIOD_LINE_ACTIVE_STATE_HIGH);
I connected one of the GPIO outputs on X5 on the dev board to one of the user LEDs (LED21) on X38. That worked fine.
Then I changed the third argument to GPIOD_LINE_ACTIVE_STATE_LOW. And the LED still comes on ?!
After poking around, I found out that GPIOD_LINE_ACTIVE_STATE_LOW has numeric value 2. In gpiod.h these two are declared as follows :
/**
-
@brief Possible active state settings.
*/
enum {
GPIOD_LINE_ACTIVE_STATE_HIGH = 1,
/< The active state of a GPIO is active-high. */
GPIOD_LINE_ACTIVE_STATE_LOW,
/< The active state of a GPIO is active-low. */
};
The third argument is an integer, and from what I’ve seen I’m assuming 0 is off/low and non-zero is on/high. Passing in a ‘0’ instead of one of the enumerations works fine. Just wondering how something like this made it in? And leery of using any of the gpiod enumerations now.