From d3ccdd2cea2b34e630e88c06239c641fd1a73a87 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 11 Sep 2025 00:19:52 -0700 Subject: [PATCH] altos: Delay checking button state until regular interrupt This makes sure the port configuration has settled down before attempting to read the input pin. Signed-off-by: Keith Packard --- src/drivers/ao_button.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/drivers/ao_button.c b/src/drivers/ao_button.c index 4c18400a..52622ad8 100644 --- a/src/drivers/ao_button.c +++ b/src/drivers/ao_button.c @@ -126,10 +126,9 @@ static void _ao_button_init(uint8_t b) { uint32_t m = ao_arch_irqsave(); - uint8_t value = _ao_button_get(b); - ao_button_state[b].value = value; - ao_button_state[b].time = ao_time(); - ao_button_queue(b, value); + /* let the regular button check code figure out the initial state */ + ao_button_state[b].value = 2; + ao_button_state[b].time = ao_time() - 2 * AO_BUTTON_DEBOUNCE_INTERVAL; ao_arch_irqrestore(m); } -- 2.47.3