From 99dc7b2e7eacd00c2e00c2777e5b7f0af35104fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Sun, 23 Oct 2022 18:52:46 +0200 Subject: [PATCH] Fix bug --- main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.c b/main.c index 7b62b33..4c5d15b 100644 --- a/main.c +++ b/main.c @@ -265,11 +265,10 @@ int main(void) /* Isolate lowest set bit. This prevents edge cases where multipe switches are pressed */ button_pressed = 0u; for (i = 0; i < 8; i++) { - if (port & 0x1) { + if (port & (1 << i)) { button_pressed = i + 1u; break; } - port >>= 1; } if (button_pressed) {