This commit is contained in:
Mario Hüttel 2022-10-23 18:52:46 +02:00
parent 0e10c7048f
commit 99dc7b2e7e

3
main.c
View File

@ -265,11 +265,10 @@ int main(void)
/* Isolate lowest set bit. This prevents edge cases where multipe switches are pressed */ /* Isolate lowest set bit. This prevents edge cases where multipe switches are pressed */
button_pressed = 0u; button_pressed = 0u;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
if (port & 0x1) { if (port & (1 << i)) {
button_pressed = i + 1u; button_pressed = i + 1u;
break; break;
} }
port >>= 1;
} }
if (button_pressed) { if (button_pressed) {