I want to write to GPIO 128. Inside linux/gpio.h
there is struct gpiohandle_request
which hold information about a GPIO handle request. I saw this example:
Let say we want to configure pin 17 and 27 as OUTPUT and we want to write HIGH (1) on pin 17 and LOW (0) on pin 27.
struct gpiohandle_request rq;
rq.lineoffsets[0] = 17;
rq.lineoffsets[1] = 27;
rq.lines = 2;
rq.flags = GPIOHANDLE_REQUEST_OUTPUT;
Now I am confused about lineoffsets. Documentation specify that:
- @lineoffsets: an array desired lines, specified by offset index for the associated GPIO device
What does a line mean? If I want to configure gpio0
to gpio127
can I make a loop this way:
for (int i = 0; i < 128; i++) {
rq.lineoffsets[i] = i;
}