Fix bug
This commit is contained in:
parent
0e10c7048f
commit
99dc7b2e7e
3
main.c
3
main.c
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user