diff options
author | Nick Brassel <nick@tzarc.org> | 2024-03-10 22:24:17 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-10 22:24:17 +1100 |
commit | 3e1ac7a38fa4e6885053a762bc75f7c4e068eccb (patch) | |
tree | 102642e387cebb67a840ae23ffda5d7413f33a71 /quantum/encoder.h | |
parent | be42ea306b36bf7fac8b790452536156de8efcf6 (diff) |
Fixes for encoder abstraction. (#23195)
Diffstat (limited to 'quantum/encoder.h')
-rw-r--r-- | quantum/encoder.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/quantum/encoder.h b/quantum/encoder.h index 90414a43a0..317a91f1da 100644 --- a/quantum/encoder.h +++ b/quantum/encoder.h @@ -29,6 +29,7 @@ __attribute__((weak)) bool should_process_encoder(void); void encoder_init(void); bool encoder_task(void); bool encoder_queue_event(uint8_t index, bool clockwise); +bool encoder_dequeue_event(uint8_t *index, bool *clockwise); bool encoder_update_kb(uint8_t index, bool clockwise); bool encoder_update_user(uint8_t index, bool clockwise); @@ -82,6 +83,8 @@ typedef struct encoder_event_t { } encoder_event_t; typedef struct encoder_events_t { + uint8_t enqueued; + uint8_t dequeued; uint8_t head; uint8_t tail; encoder_event_t queue[MAX_QUEUED_ENCODER_EVENTS]; @@ -90,10 +93,12 @@ typedef struct encoder_events_t { // Get the current queued events void encoder_retrieve_events(encoder_events_t *events); -# ifdef SPLIT_KEYBOARD -void encoder_set_tail_index(uint8_t tail_index); -void encoder_handle_slave_events(encoder_events_t *events); -# endif // SPLIT_KEYBOARD +// Encoder event queue management +bool encoder_queue_event_advanced(encoder_events_t *events, uint8_t index, bool clockwise); +bool encoder_dequeue_event_advanced(encoder_events_t *events, uint8_t *index, bool *clockwise); + +// Reset the queue to be empty +void encoder_signal_queue_drain(void); # ifdef ENCODER_MAP_ENABLE # define NUM_DIRECTIONS 2 |