n0ukf wrote:The application for this question is for making a game buzzer, first contestant to press their button gets their light lit. It needs to be fast enough to prevent reading a tie, and if there is a tie, some indication of that condition (if the buttons are sequentially tested and that test exits on the first true, 1 will always win over 2 if tied).
In that case using what paddyg suggested and read a bank of GPIOs in one go, as long as all the GPIOs are in the same bank you get them in 1 read (and there are only 2 banks, GPIO 0-31 and GPIO 32-53), you just look at the individual bitsof the value read relating to the GPIOs you are interested in, if more than one is set then the buttons will have been detected at the same time.