Fixes for encoder abstraction. (#23195)
This commit is contained in:
parent
be42ea306b
commit
3e1ac7a38f
4 changed files with 101 additions and 38 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue