From 38c6a7fee6fdd657bffcc7b421036e5b423e47fd Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Wed, 10 Nov 2021 19:29:34 +0100 Subject: [PATCH] Fixed bug in MD3x keyboard driver causing the generation of an UP keypress at boot (#48) --- platform/drivers/keyboard/keyboard_MD3x.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platform/drivers/keyboard/keyboard_MD3x.c b/platform/drivers/keyboard/keyboard_MD3x.c index c8539c28..a7ee8390 100644 --- a/platform/drivers/keyboard/keyboard_MD3x.c +++ b/platform/drivers/keyboard/keyboard_MD3x.c @@ -26,6 +26,8 @@ #include #include "hwconfig.h" +static int8_t old_pos = 0; + void kbd_init() { /* Set the two row lines as outputs */ @@ -35,6 +37,9 @@ void kbd_init() gpio_clearPin(KB_ROW1); gpio_clearPin(KB_ROW2); gpio_clearPin(KB_ROW3); + + /* Initialise old position */ + old_pos = platform_getChSelector(); } void kbd_terminate() @@ -53,7 +58,6 @@ keyboard_t kbd_getKeys() keyboard_t keys = 0; /* Read channel knob to send KNOB_LEFT and KNOB_RIGHT events */ - static int8_t old_pos = 0; int8_t new_pos = platform_getChSelector(); if (old_pos != new_pos) {