rdancer / Color_LCD

0 stars 0 forks source link

Button presses are polled, not interrupt-driven #12

Open rdancer opened 3 years ago

rdancer commented 3 years ago

This project will need substantial rewrite. The wireless project also?

The processing seems to use single thread, one dispatch loop that polls RTC and every 100ms or so polls UART data; every 20ms or so polls for a button being pressed.

There seems to be something weird going on as well. Pressing fast repeat:

rdancer commented 3 years ago

The processor supports various flavours of interrupts

Unsuitable:

Interesting:

rdancer commented 2 years ago

We only need input on GPIOs, and only for four buttons at a time. Could add more buttons, though, say a dedicated lights or cruise button. What we are doing is basically implementing a keyboard controller on the main CPU, which normally would be handled by a separate IC that would expose a nicely ordered byte stream of keystrokes, with a short buffer, and a single interrupt when there were keystrokes available. We can easily do this on the microcontroller, because no-one is gonna strike 60 words per minute on the keypads we use, and because key handling is low-compute-intensive on 2021 hardware. But we still need to do it at a higher priority than the normal code, and we still need to provide a nicely ordered keystroke buffer, and a single interrupt when there are keystrokes available. Or maybe we can directly execute event handlers, and swap the event handlers in and out depending on context, at least for some keystrokes: