summaryrefslogtreecommitdiff
path: root/quantum/encoder.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2019-07-16 01:40:54 -0700
committerskullydazed <skullydazed@users.noreply.github.com>2019-07-16 01:40:54 -0700
commitf6c7e114260890292dcd12645db7fecd64167973 (patch)
tree0edeec134b20c100e793886d7b5b55f0e1917c19 /quantum/encoder.c
parent97a3f806c4740213d7b133f0be7c2f51d228593b (diff)
Remove the need to specify NUM_OF_ENCODERS for the Encoder feature (#6328)
* Remove the need to set NUM_OF_ENCODERS Instead, calculate the size of the array, and use that instead * Add hack for split common support * Remove NUM_OF_ENCODERS from keyboard config Can be reverted, if needed
Diffstat (limited to 'quantum/encoder.c')
-rw-r--r--quantum/encoder.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/quantum/encoder.c b/quantum/encoder.c
index ddf6234ab8..31f00c346b 100644
--- a/quantum/encoder.c
+++ b/quantum/encoder.c
@@ -25,16 +25,14 @@
#define ENCODER_RESOLUTION 4
#endif
-#ifndef NUMBER_OF_ENCODERS
- #error "Number of encoders not defined by NUMBER_OF_ENCODERS"
-#endif
-
#if !defined(ENCODERS_PAD_A) || !defined(ENCODERS_PAD_B)
#error "No encoder pads defined by ENCODERS_PAD_A and ENCODERS_PAD_B"
#endif
-static pin_t encoders_pad_a[NUMBER_OF_ENCODERS] = ENCODERS_PAD_A;
-static pin_t encoders_pad_b[NUMBER_OF_ENCODERS] = ENCODERS_PAD_B;
+
+#define NUMBER_OF_ENCODERS (sizeof(encoders_pad_a)/sizeof(pin_t))
+static pin_t encoders_pad_a[] = ENCODERS_PAD_A;
+static pin_t encoders_pad_b[] = ENCODERS_PAD_B;
static int8_t encoder_LUT[] = { 0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0 };