From c9f619124d41637ece157570703423c3890cb6c2 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Sun, 16 Apr 2023 01:18:44 +1000 Subject: Encodermap direction define. (#20454) --- quantum/encoder.h | 3 ++- quantum/keymap_introspection.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'quantum') diff --git a/quantum/encoder.h b/quantum/encoder.h index 4eb67fa25d..7644853b30 100644 --- a/quantum/encoder.h +++ b/quantum/encoder.h @@ -57,7 +57,8 @@ void encoder_update_raw(uint8_t* slave_state); #define NUM_ENCODERS_MAX_PER_SIDE MAX(NUM_ENCODERS_LEFT, NUM_ENCODERS_RIGHT) #ifdef ENCODER_MAP_ENABLE +# define NUM_DIRECTIONS 2 # define ENCODER_CCW_CW(ccw, cw) \ { (cw), (ccw) } -extern const uint16_t encoder_map[][NUM_ENCODERS][2]; +extern const uint16_t encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS]; #endif // ENCODER_MAP_ENABLE diff --git a/quantum/keymap_introspection.c b/quantum/keymap_introspection.c index 2459ad0df5..977b949340 100644 --- a/quantum/keymap_introspection.c +++ b/quantum/keymap_introspection.c @@ -46,7 +46,7 @@ __attribute__((weak)) uint16_t keycode_at_keymap_location(uint8_t layer_num, uin #if defined(ENCODER_ENABLE) && defined(ENCODER_MAP_ENABLE) -# define NUM_ENCODERMAP_LAYERS_RAW ((uint8_t)(sizeof(encoder_map) / ((NUM_ENCODERS) * (2) * sizeof(uint16_t)))) +# define NUM_ENCODERMAP_LAYERS_RAW ((uint8_t)(sizeof(encoder_map) / ((NUM_ENCODERS) * (NUM_DIRECTIONS) * sizeof(uint16_t)))) uint8_t encodermap_layer_count_raw(void) { return NUM_ENCODERMAP_LAYERS_RAW; -- cgit v1.2.3