DSO Shell - Rewired rotary encoder + buttons
So, as seen previously, the screen is conflicting with the rotary encoder making it very inaccurate and unresponsive.
We have freed the RX/TX pins , so we can use them as left/right for the rotary encoder
While we are at it, let's add some hardware debouncing to reduce the noise on the interrupt lines of left/right.
Again, it does not conflict with the screen any longer, so we can add caps to the lines.
I cut the 1 & 2pins below the rotary encoder (the 2 left side on the pic), that disconnects PB0 & PB1.
The regular buttons are now managed by a FreeRTOS task that lazily poll them and do software debouncing.
Since we are using RX/TX pins, we have the rotary encoder connected to port A.
No need to block the EXT irq when updating the screen (port B) => no missed transitions.
The interrupt is pretty fast, just a lockup table search.
The buttons are a two layers software debouncer, so no interrupt there either.
We have freed the RX/TX pins , so we can use them as left/right for the rotary encoder
While we are at it, let's add some hardware debouncing to reduce the noise on the interrupt lines of left/right.
Again, it does not conflict with the screen any longer, so we can add caps to the lines.
I cut the 1 & 2pins below the rotary encoder (the 2 left side on the pic), that disconnects PB0 & PB1.
The regular buttons are now managed by a FreeRTOS task that lazily poll them and do software debouncing.
Since we are using RX/TX pins, we have the rotary encoder connected to port A.
No need to block the EXT irq when updating the screen (port B) => no missed transitions.
The interrupt is pretty fast, just a lockup table search.
The buttons are a two layers software debouncer, so no interrupt there either.
- First an integrator debouncer to filter out the noise
- Second, a small finite state machine to issue events : short press & long press
Almost finished, just needs a bit of cleaning up and protecting the poll from the screen (which can be done lazily)
Comments
Post a Comment