Newb alert !
In the C API doco for gpioSetAlertFunc there is a comment "Do not use gpioRead. ".
Does this mean for the GPIO trigger that caused to callback to be called ? That makes sense as the data is already in the parameters, and pin state may have subsequently changed. Or does it mean don't use it at all (specifically I need to read other GPIO pins) ?
I am restoring an old computer control panel that has 24 lamps, 7 buttons, and 22 switches. There are a few complicated use cases, in particular when the RUN button is pressed, you need to read the bank of "instruction" switches (all 18 of them).
I did try an experiment of this in Python, with a button and a few switches wired to GPIO pins, but the gpioRead (of the switches) didn't appear to work, I totally accept that a wiring error on my part may be the most likely cause.
I've since moved on and am implementing in C now as there are a lot of libraries to call (for the panel operations), and want to be sure what is the best approach.
Should I exit the callback as soon as possible, and say set a Global button-pressed variable and then inside a main loop State Machine read the 18 switches (now on I2C) ? or is there a way I can do this within the callback function (mainly to simplify the logic of my program) ?
(I have read the pigpio doco, examples and posts here)