summaryrefslogtreecommitdiff
path: root/quantum/encoder
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2024-02-18 21:17:15 +1100
committerGitHub <noreply@github.com>2024-02-18 21:17:15 +1100
commit9d9cdaaa2d035787b0b50c26f2975695fdbc16f4 (patch)
tree1a9f5d16ffc0e3bd27bc14791c25405a79ccd069 /quantum/encoder
parent2eb9ff8efd1df2c98724481c71c8ab8a5b62e31e (diff)
Add encoder abstraction. (#21548)
Diffstat (limited to 'quantum/encoder')
-rw-r--r--quantum/encoder/tests/config_encoder_common.h6
-rw-r--r--quantum/encoder/tests/config_mock.h3
-rw-r--r--quantum/encoder/tests/config_mock_split_left_eq_right.h3
-rw-r--r--quantum/encoder/tests/config_mock_split_left_gt_right.h3
-rw-r--r--quantum/encoder/tests/config_mock_split_left_lt_right.h3
-rw-r--r--quantum/encoder/tests/config_mock_split_no_left.h3
-rw-r--r--quantum/encoder/tests/config_mock_split_no_right.h3
-rw-r--r--quantum/encoder/tests/config_mock_split_role.h3
-rw-r--r--quantum/encoder/tests/encoder_tests.cpp2
-rw-r--r--quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp91
-rw-r--r--quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp89
-rw-r--r--quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp89
-rw-r--r--quantum/encoder/tests/encoder_tests_split_no_left.cpp69
-rw-r--r--quantum/encoder/tests/encoder_tests_split_no_right.cpp66
-rw-r--r--quantum/encoder/tests/encoder_tests_split_role.cpp8
-rw-r--r--quantum/encoder/tests/mock_split.c4
-rw-r--r--quantum/encoder/tests/mock_split.h3
-rw-r--r--quantum/encoder/tests/rules.mk7
18 files changed, 329 insertions, 126 deletions
diff --git a/quantum/encoder/tests/config_encoder_common.h b/quantum/encoder/tests/config_encoder_common.h
new file mode 100644
index 0000000000..6b3b20182b
--- /dev/null
+++ b/quantum/encoder/tests/config_encoder_common.h
@@ -0,0 +1,6 @@
1// Copyright 2023 Nick Brassel (@tzarc)
2// SPDX-License-Identifier: GPL-2.0-or-later
3#pragma once
4
5// Override the one in quantum/util because it doesn't like working on x64 builds.
6#define ARRAY_SIZE(array) (sizeof((array)) / sizeof((array)[0]))
diff --git a/quantum/encoder/tests/config_mock.h b/quantum/encoder/tests/config_mock.h
index 703dcaf103..9eb59ddc88 100644
--- a/quantum/encoder/tests/config_mock.h
+++ b/quantum/encoder/tests/config_mock.h
@@ -1,6 +1,7 @@
1// Copyright 2022 Nick Brassel (@tzarc) 1// Copyright 2022-2023 Nick Brassel (@tzarc)
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3#pragma once 3#pragma once
4#include "config_encoder_common.h"
4 5
5#define MATRIX_ROWS 1 6#define MATRIX_ROWS 1
6#define MATRIX_COLS 1 7#define MATRIX_COLS 1
diff --git a/quantum/encoder/tests/config_mock_split_left_eq_right.h b/quantum/encoder/tests/config_mock_split_left_eq_right.h
index c80ac4d519..ea795657ef 100644
--- a/quantum/encoder/tests/config_mock_split_left_eq_right.h
+++ b/quantum/encoder/tests/config_mock_split_left_eq_right.h
@@ -1,6 +1,7 @@
1// Copyright 2022 Nick Brassel (@tzarc) 1// Copyright 2022-2023 Nick Brassel (@tzarc)
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3#pragma once 3#pragma once
4#include "config_encoder_common.h"
4 5
5#define MATRIX_ROWS 1 6#define MATRIX_ROWS 1
6#define MATRIX_COLS 1 7#define MATRIX_COLS 1
diff --git a/quantum/encoder/tests/config_mock_split_left_gt_right.h b/quantum/encoder/tests/config_mock_split_left_gt_right.h
index 91d5f3d605..abcfe03918 100644
--- a/quantum/encoder/tests/config_mock_split_left_gt_right.h
+++ b/quantum/encoder/tests/config_mock_split_left_gt_right.h
@@ -1,6 +1,7 @@
1// Copyright 2022 Nick Brassel (@tzarc) 1// Copyright 2022-2023 Nick Brassel (@tzarc)
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3#pragma once 3#pragma once
4#include "config_encoder_common.h"
4 5
5#define MATRIX_ROWS 1 6#define MATRIX_ROWS 1
6#define MATRIX_COLS 1 7#define MATRIX_COLS 1
diff --git a/quantum/encoder/tests/config_mock_split_left_lt_right.h b/quantum/encoder/tests/config_mock_split_left_lt_right.h
index 4108a184a6..075c774b0d 100644
--- a/quantum/encoder/tests/config_mock_split_left_lt_right.h
+++ b/quantum/encoder/tests/config_mock_split_left_lt_right.h
@@ -1,6 +1,7 @@
1// Copyright 2022 Nick Brassel (@tzarc) 1// Copyright 2022-2023 Nick Brassel (@tzarc)
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3#pragma once 3#pragma once
4#include "config_encoder_common.h"
4 5
5#define MATRIX_ROWS 1 6#define MATRIX_ROWS 1
6#define MATRIX_COLS 1 7#define MATRIX_COLS 1
diff --git a/quantum/encoder/tests/config_mock_split_no_left.h b/quantum/encoder/tests/config_mock_split_no_left.h
index 9db7fa7e41..dfd8358929 100644
--- a/quantum/encoder/tests/config_mock_split_no_left.h
+++ b/quantum/encoder/tests/config_mock_split_no_left.h
@@ -1,6 +1,7 @@
1// Copyright 2022 Nick Brassel (@tzarc) 1// Copyright 2022-2023 Nick Brassel (@tzarc)
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3#pragma once 3#pragma once
4#include "config_encoder_common.h"
4 5
5#define MATRIX_ROWS 1 6#define MATRIX_ROWS 1
6#define MATRIX_COLS 1 7#define MATRIX_COLS 1
diff --git a/quantum/encoder/tests/config_mock_split_no_right.h b/quantum/encoder/tests/config_mock_split_no_right.h
index 14f18015e6..5683eade8c 100644
--- a/quantum/encoder/tests/config_mock_split_no_right.h
+++ b/quantum/encoder/tests/config_mock_split_no_right.h
@@ -1,6 +1,7 @@
1// Copyright 2022 Nick Brassel (@tzarc) 1// Copyright 2022-2023 Nick Brassel (@tzarc)
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3#pragma once 3#pragma once
4#include "config_encoder_common.h"
4 5
5#define MATRIX_ROWS 1 6#define MATRIX_ROWS 1
6#define MATRIX_COLS 1 7#define MATRIX_COLS 1
diff --git a/quantum/encoder/tests/config_mock_split_role.h b/quantum/encoder/tests/config_mock_split_role.h
index c80ac4d519..ea795657ef 100644
--- a/quantum/encoder/tests/config_mock_split_role.h
+++ b/quantum/encoder/tests/config_mock_split_role.h
@@ -1,6 +1,7 @@
1// Copyright 2022 Nick Brassel (@tzarc) 1// Copyright 2022-2023 Nick Brassel (@tzarc)
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3#pragma once 3#pragma once
4#include "config_encoder_common.h"
4 5
5#define MATRIX_ROWS 1 6#define MATRIX_ROWS 1
6#define MATRIX_COLS 1 7#define MATRIX_COLS 1
diff --git a/quantum/encoder/tests/encoder_tests.cpp b/quantum/encoder/tests/encoder_tests.cpp
index b7c18aeec0..499e413aed 100644
--- a/quantum/encoder/tests/encoder_tests.cpp
+++ b/quantum/encoder/tests/encoder_tests.cpp
@@ -41,7 +41,7 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
41 41
42bool setAndRead(pin_t pin, bool val) { 42bool setAndRead(pin_t pin, bool val) {
43 setPin(pin, val); 43 setPin(pin, val);
44 return encoder_read(); 44 return encoder_task();
45} 45}
46 46
47class EncoderTest : public ::testing::Test {}; 47class EncoderTest : public ::testing::Test {};
diff --git a/quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp b/quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp
index 916e47b185..7d6b3e30e6 100644
--- a/quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp
+++ b/quantum/encoder/tests/encoder_tests_split_left_eq_right.cpp
@@ -33,22 +33,29 @@ struct update {
33uint8_t updates_array_idx = 0; 33uint8_t updates_array_idx = 0;
34update updates[32]; 34update updates[32];
35 35
36bool isMaster;
36bool isLeftHand; 37bool isLeftHand;
37 38
39extern "C" {
40bool is_keyboard_master(void) {
41 return isMaster;
42}
43
38bool encoder_update_kb(uint8_t index, bool clockwise) { 44bool encoder_update_kb(uint8_t index, bool clockwise) {
39 if (!isLeftHand) { 45 if (!is_keyboard_master()) {
40 // this method has no effect on slave half 46 // this method has no effect on slave half
41 printf("ignoring update on right hand (%d,%s)\n", index, clockwise ? "CW" : "CC"); 47 printf("ignoring update on slave (%d,%s)\n", index, clockwise ? "CW" : "CC");
42 return true; 48 return true;
43 } 49 }
44 updates[updates_array_idx % 32] = {index, clockwise}; 50 updates[updates_array_idx % 32] = {index, clockwise};
45 updates_array_idx++; 51 updates_array_idx++;
46 return true; 52 return true;
47} 53}
54};
48 55
49bool setAndRead(pin_t pin, bool val) { 56bool setAndRead(pin_t pin, bool val) {
50 setPin(pin, val); 57 setPin(pin, val);
51 return encoder_read(); 58 return encoder_task();
52} 59}
53 60
54class EncoderSplitTestLeftEqRight : public ::testing::Test { 61class EncoderSplitTestLeftEqRight : public ::testing::Test {
@@ -63,6 +70,7 @@ class EncoderSplitTestLeftEqRight : public ::testing::Test {
63}; 70};
64 71
65TEST_F(EncoderSplitTestLeftEqRight, TestInitLeft) { 72TEST_F(EncoderSplitTestLeftEqRight, TestInitLeft) {
73 isMaster = true;
66 isLeftHand = true; 74 isLeftHand = true;
67 encoder_init(); 75 encoder_init();
68 EXPECT_EQ(pinIsInputHigh[0], true); 76 EXPECT_EQ(pinIsInputHigh[0], true);
@@ -77,6 +85,7 @@ TEST_F(EncoderSplitTestLeftEqRight, TestInitLeft) {
77} 85}
78 86
79TEST_F(EncoderSplitTestLeftEqRight, TestInitRight) { 87TEST_F(EncoderSplitTestLeftEqRight, TestInitRight) {
88 isMaster = true;
80 isLeftHand = false; 89 isLeftHand = false;
81 encoder_init(); 90 encoder_init();
82 EXPECT_EQ(pinIsInputHigh[0], false); 91 EXPECT_EQ(pinIsInputHigh[0], false);
@@ -90,7 +99,8 @@ TEST_F(EncoderSplitTestLeftEqRight, TestInitRight) {
90 EXPECT_EQ(updates_array_idx, 0); // no updates received 99 EXPECT_EQ(updates_array_idx, 0); // no updates received
91} 100}
92 101
93TEST_F(EncoderSplitTestLeftEqRight, TestOneClockwiseLeft) { 102TEST_F(EncoderSplitTestLeftEqRight, TestOneClockwiseLeftMaster) {
103 isMaster = true;
94 isLeftHand = true; 104 isLeftHand = true;
95 encoder_init(); 105 encoder_init();
96 // send 4 pulses. with resolution 4, that's one step and we should get 1 update. 106 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
@@ -102,9 +112,19 @@ TEST_F(EncoderSplitTestLeftEqRight, TestOneClockwiseLeft) {
102 EXPECT_EQ(updates_array_idx, 1); // one update received 112 EXPECT_EQ(updates_array_idx, 1); // one update received
103 EXPECT_EQ(updates[0].index, 0); 113 EXPECT_EQ(updates[0].index, 0);
104 EXPECT_EQ(updates[0].clockwise, true); 114 EXPECT_EQ(updates[0].clockwise, true);
115
116 int events_queued = 0;
117 encoder_events_t events;
118 encoder_retrieve_events(&events);
119 while (events.tail != events.head) {
120 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
121 ++events_queued;
122 }
123 EXPECT_EQ(events_queued, 0); // No events should be queued on master
105} 124}
106 125
107TEST_F(EncoderSplitTestLeftEqRight, TestOneClockwiseRightSent) { 126TEST_F(EncoderSplitTestLeftEqRight, TestOneClockwiseRightMaster) {
127 isMaster = true;
108 isLeftHand = false; 128 isLeftHand = false;
109 encoder_init(); 129 encoder_init();
110 // send 4 pulses. with resolution 4, that's one step and we should get 1 update. 130 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
@@ -113,23 +133,60 @@ TEST_F(EncoderSplitTestLeftEqRight, TestOneClockwiseRightSent) {
113 setAndRead(6, true); 133 setAndRead(6, true);
114 setAndRead(7, true); 134 setAndRead(7, true);
115 135
116 uint8_t slave_state[32] = {0}; 136 EXPECT_EQ(updates_array_idx, 1); // one update received
117 encoder_state_raw(slave_state); 137 EXPECT_EQ(updates[0].index, 3);
138 EXPECT_EQ(updates[0].clockwise, true);
118 139
119 EXPECT_EQ(slave_state[0], 0); 140 int events_queued = 0;
120 EXPECT_EQ(slave_state[1], 0xFF); 141 encoder_events_t events;
142 encoder_retrieve_events(&events);
143 while (events.tail != events.head) {
144 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
145 ++events_queued;
146 }
147 EXPECT_EQ(events_queued, 0); // No events should be queued on master
121} 148}
122 149
123TEST_F(EncoderSplitTestLeftEqRight, TestMultipleEncodersRightReceived) { 150TEST_F(EncoderSplitTestLeftEqRight, TestOneClockwiseLeftSlave) {
151 isMaster = false;
124 isLeftHand = true; 152 isLeftHand = true;
125 encoder_init(); 153 encoder_init();
154 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
155 setAndRead(0, false);
156 setAndRead(1, false);
157 setAndRead(0, true);
158 setAndRead(1, true);
126 159
127 uint8_t slave_state[32] = {1, 0xFF}; // First right encoder is CCW, Second right encoder CW 160 EXPECT_EQ(updates_array_idx, 0); // no updates received
128 encoder_update_raw(slave_state);
129 161
130 EXPECT_EQ(updates_array_idx, 2); // two updates received, one for each changed item on the right side 162 int events_queued = 0;
131 EXPECT_EQ(updates[0].index, 2); 163 encoder_events_t events;
132 EXPECT_EQ(updates[0].clockwise, false); 164 encoder_retrieve_events(&events);
133 EXPECT_EQ(updates[1].index, 3); 165 while (events.tail != events.head) {
134 EXPECT_EQ(updates[1].clockwise, true); 166 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
167 ++events_queued;
168 }
169 EXPECT_EQ(events_queued, 1); // One event should be queued on slave
170}
171
172TEST_F(EncoderSplitTestLeftEqRight, TestOneClockwiseRightSlave) {
173 isMaster = false;
174 isLeftHand = false;
175 encoder_init();
176 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
177 setAndRead(6, false);
178 setAndRead(7, false);
179 setAndRead(6, true);
180 setAndRead(7, true);
181
182 EXPECT_EQ(updates_array_idx, 0); // no updates received
183
184 int events_queued = 0;
185 encoder_events_t events;
186 encoder_retrieve_events(&events);
187 while (events.tail != events.head) {
188 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
189 ++events_queued;
190 }
191 EXPECT_EQ(events_queued, 1); // One event should be queued on slave
135} 192}
diff --git a/quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp b/quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp
index 7b64bb2981..2beb4e3972 100644
--- a/quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp
+++ b/quantum/encoder/tests/encoder_tests_split_left_gt_right.cpp
@@ -33,22 +33,29 @@ struct update {
33uint8_t updates_array_idx = 0; 33uint8_t updates_array_idx = 0;
34update updates[32]; 34update updates[32];
35 35
36bool isMaster;
36bool isLeftHand; 37bool isLeftHand;
37 38
39extern "C" {
40bool is_keyboard_master(void) {
41 return isMaster;
42}
43
38bool encoder_update_kb(uint8_t index, bool clockwise) { 44bool encoder_update_kb(uint8_t index, bool clockwise) {
39 if (!isLeftHand) { 45 if (!is_keyboard_master()) {
40 // this method has no effect on slave half 46 // this method has no effect on slave half
41 printf("ignoring update on right hand (%d,%s)\n", index, clockwise ? "CW" : "CC"); 47 printf("ignoring update on slave (%d,%s)\n", index, clockwise ? "CW" : "CC");
42 return true; 48 return true;
43 } 49 }
44 updates[updates_array_idx % 32] = {index, clockwise}; 50 updates[updates_array_idx % 32] = {index, clockwise};
45 updates_array_idx++; 51 updates_array_idx++;
46 return true; 52 return true;
47} 53}
54};
48 55
49bool setAndRead(pin_t pin, bool val) { 56bool setAndRead(pin_t pin, bool val) {
50 setPin(pin, val); 57 setPin(pin, val);
51 return encoder_read(); 58 return encoder_task();
52} 59}
53 60
54class EncoderSplitTestLeftGreaterThanRight : public ::testing::Test { 61class EncoderSplitTestLeftGreaterThanRight : public ::testing::Test {
@@ -94,7 +101,8 @@ TEST_F(EncoderSplitTestLeftGreaterThanRight, TestInitRight) {
94 EXPECT_EQ(updates_array_idx, 0); // no updates received 101 EXPECT_EQ(updates_array_idx, 0); // no updates received
95} 102}
96 103
97TEST_F(EncoderSplitTestLeftGreaterThanRight, TestOneClockwiseLeft) { 104TEST_F(EncoderSplitTestLeftGreaterThanRight, TestOneClockwiseLeftMaster) {
105 isMaster = true;
98 isLeftHand = true; 106 isLeftHand = true;
99 encoder_init(); 107 encoder_init();
100 // send 4 pulses. with resolution 4, that's one step and we should get 1 update. 108 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
@@ -106,9 +114,19 @@ TEST_F(EncoderSplitTestLeftGreaterThanRight, TestOneClockwiseLeft) {
106 EXPECT_EQ(updates_array_idx, 1); // one update received 114 EXPECT_EQ(updates_array_idx, 1); // one update received
107 EXPECT_EQ(updates[0].index, 0); 115 EXPECT_EQ(updates[0].index, 0);
108 EXPECT_EQ(updates[0].clockwise, true); 116 EXPECT_EQ(updates[0].clockwise, true);
117
118 int events_queued = 0;
119 encoder_events_t events;
120 encoder_retrieve_events(&events);
121 while (events.tail != events.head) {
122 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
123 ++events_queued;
124 }
125 EXPECT_EQ(events_queued, 0); // No events should be queued on master
109} 126}
110 127
111TEST_F(EncoderSplitTestLeftGreaterThanRight, TestOneClockwiseRightSent) { 128TEST_F(EncoderSplitTestLeftGreaterThanRight, TestOneClockwiseRightMaster) {
129 isMaster = true;
112 isLeftHand = false; 130 isLeftHand = false;
113 encoder_init(); 131 encoder_init();
114 // send 4 pulses. with resolution 4, that's one step and we should get 1 update. 132 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
@@ -117,23 +135,60 @@ TEST_F(EncoderSplitTestLeftGreaterThanRight, TestOneClockwiseRightSent) {
117 setAndRead(6, true); 135 setAndRead(6, true);
118 setAndRead(7, true); 136 setAndRead(7, true);
119 137
120 uint8_t slave_state[32] = {0}; 138 EXPECT_EQ(updates_array_idx, 1); // one update received
121 encoder_state_raw(slave_state); 139 EXPECT_EQ(updates[0].index, 3);
140 EXPECT_EQ(updates[0].clockwise, true);
122 141
123 EXPECT_EQ(slave_state[0], 0xFF); 142 int events_queued = 0;
124 EXPECT_EQ(slave_state[1], 0); 143 encoder_events_t events;
144 encoder_retrieve_events(&events);
145 while (events.tail != events.head) {
146 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
147 ++events_queued;
148 }
149 EXPECT_EQ(events_queued, 0); // No events should be queued on master
125} 150}
126 151
127TEST_F(EncoderSplitTestLeftGreaterThanRight, TestMultipleEncodersRightReceived) { 152TEST_F(EncoderSplitTestLeftGreaterThanRight, TestOneClockwiseLeftSlave) {
153 isMaster = false;
128 isLeftHand = true; 154 isLeftHand = true;
129 encoder_init(); 155 encoder_init();
156 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
157 setAndRead(0, false);
158 setAndRead(1, false);
159 setAndRead(0, true);
160 setAndRead(1, true);
130 161
131 uint8_t slave_state[32] = {1, 0xFF}; // First right encoder is CCW, Second right encoder no change, third right encoder CW 162 EXPECT_EQ(updates_array_idx, 0); // no updates received
132 encoder_update_raw(slave_state);
133 163
134 EXPECT_EQ(updates_array_idx, 2); // two updates received, one for each changed item on the right side 164 int events_queued = 0;
135 EXPECT_EQ(updates[0].index, 3); 165 encoder_events_t events;
136 EXPECT_EQ(updates[0].clockwise, false); 166 encoder_retrieve_events(&events);
137 EXPECT_EQ(updates[1].index, 4); 167 while (events.tail != events.head) {
138 EXPECT_EQ(updates[1].clockwise, true); 168 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
169 ++events_queued;
170 }
171 EXPECT_EQ(events_queued, 1); // One event should be queued on slave
172}
173
174TEST_F(EncoderSplitTestLeftGreaterThanRight, TestOneClockwiseRightSlave) {
175 isMaster = false;
176 isLeftHand = false;
177 encoder_init();
178 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
179 setAndRead(6, false);
180 setAndRead(7, false);
181 setAndRead(6, true);
182 setAndRead(7, true);
183
184 EXPECT_EQ(updates_array_idx, 0); // no updates received
185
186 int events_queued = 0;
187 encoder_events_t events;
188 encoder_retrieve_events(&events);
189 while (events.tail != events.head) {
190 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
191 ++events_queued;
192 }
193 EXPECT_EQ(events_queued, 1); // One event should be queued on slave
139} 194}
diff --git a/quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp b/quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp
index a6519c5762..5612f8b658 100644
--- a/quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp
+++ b/quantum/encoder/tests/encoder_tests_split_left_lt_right.cpp
@@ -33,22 +33,29 @@ struct update {
33uint8_t updates_array_idx = 0; 33uint8_t updates_array_idx = 0;
34update updates[32]; 34update updates[32];
35 35
36bool isMaster;
36bool isLeftHand; 37bool isLeftHand;
37 38
39extern "C" {
40bool is_keyboard_master(void) {
41 return isMaster;
42}
43
38bool encoder_update_kb(uint8_t index, bool clockwise) { 44bool encoder_update_kb(uint8_t index, bool clockwise) {
39 if (!isLeftHand) { 45 if (!is_keyboard_master()) {
40 // this method has no effect on slave half 46 // this method has no effect on slave half
41 printf("ignoring update on right hand (%d,%s)\n", index, clockwise ? "CW" : "CC"); 47 printf("ignoring update on slave (%d,%s)\n", index, clockwise ? "CW" : "CC");
42 return true; 48 return true;
43 } 49 }
44 updates[updates_array_idx % 32] = {index, clockwise}; 50 updates[updates_array_idx % 32] = {index, clockwise};
45 updates_array_idx++; 51 updates_array_idx++;
46 return true; 52 return true;
47} 53}
54};
48 55
49bool setAndRead(pin_t pin, bool val) { 56bool setAndRead(pin_t pin, bool val) {
50 setPin(pin, val); 57 setPin(pin, val);
51 return encoder_read(); 58 return encoder_task();
52} 59}
53 60
54class EncoderSplitTestLeftLessThanRight : public ::testing::Test { 61class EncoderSplitTestLeftLessThanRight : public ::testing::Test {
@@ -94,7 +101,8 @@ TEST_F(EncoderSplitTestLeftLessThanRight, TestInitRight) {
94 EXPECT_EQ(updates_array_idx, 0); // no updates received 101 EXPECT_EQ(updates_array_idx, 0); // no updates received
95} 102}
96 103
97TEST_F(EncoderSplitTestLeftLessThanRight, TestOneClockwiseLeft) { 104TEST_F(EncoderSplitTestLeftLessThanRight, TestOneClockwiseLeftMaster) {
105 isMaster = true;
98 isLeftHand = true; 106 isLeftHand = true;
99 encoder_init(); 107 encoder_init();
100 // send 4 pulses. with resolution 4, that's one step and we should get 1 update. 108 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
@@ -106,9 +114,19 @@ TEST_F(EncoderSplitTestLeftLessThanRight, TestOneClockwiseLeft) {
106 EXPECT_EQ(updates_array_idx, 1); // one update received 114 EXPECT_EQ(updates_array_idx, 1); // one update received
107 EXPECT_EQ(updates[0].index, 0); 115 EXPECT_EQ(updates[0].index, 0);
108 EXPECT_EQ(updates[0].clockwise, true); 116 EXPECT_EQ(updates[0].clockwise, true);
117
118 int events_queued = 0;
119 encoder_events_t events;
120 encoder_retrieve_events(&events);
121 while (events.tail != events.head) {
122 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
123 ++events_queued;
124 }
125 EXPECT_EQ(events_queued, 0); // No events should be queued on master
109} 126}
110 127
111TEST_F(EncoderSplitTestLeftLessThanRight, TestOneClockwiseRightSent) { 128TEST_F(EncoderSplitTestLeftLessThanRight, TestOneClockwiseRightMaster) {
129 isMaster = true;
112 isLeftHand = false; 130 isLeftHand = false;
113 encoder_init(); 131 encoder_init();
114 // send 4 pulses. with resolution 4, that's one step and we should get 1 update. 132 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
@@ -117,23 +135,60 @@ TEST_F(EncoderSplitTestLeftLessThanRight, TestOneClockwiseRightSent) {
117 setAndRead(6, true); 135 setAndRead(6, true);
118 setAndRead(7, true); 136 setAndRead(7, true);
119 137
120 uint8_t slave_state[32] = {0}; 138 EXPECT_EQ(updates_array_idx, 1); // one update received
121 encoder_state_raw(slave_state); 139 EXPECT_EQ(updates[0].index, 3);
140 EXPECT_EQ(updates[0].clockwise, true);
122 141
123 EXPECT_EQ(slave_state[0], 0); 142 int events_queued = 0;
124 EXPECT_EQ(slave_state[1], 0xFF); 143 encoder_events_t events;
144 encoder_retrieve_events(&events);
145 while (events.tail != events.head) {
146 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
147 ++events_queued;
148 }
149 EXPECT_EQ(events_queued, 0); // No events should be queued on master
125} 150}
126 151
127TEST_F(EncoderSplitTestLeftLessThanRight, TestMultipleEncodersRightReceived) { 152TEST_F(EncoderSplitTestLeftLessThanRight, TestOneClockwiseLeftSlave) {
153 isMaster = false;
128 isLeftHand = true; 154 isLeftHand = true;
129 encoder_init(); 155 encoder_init();
156 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
157 setAndRead(0, false);
158 setAndRead(1, false);
159 setAndRead(0, true);
160 setAndRead(1, true);
130 161
131 uint8_t slave_state[32] = {1, 0, 0xFF}; // First right encoder is CCW, Second right encoder no change, third right encoder CW 162 EXPECT_EQ(updates_array_idx, 0); // no updates received
132 encoder_update_raw(slave_state);
133 163
134 EXPECT_EQ(updates_array_idx, 2); // two updates received, one for each changed item on the right side 164 int events_queued = 0;
135 EXPECT_EQ(updates[0].index, 2); 165 encoder_events_t events;
136 EXPECT_EQ(updates[0].clockwise, false); 166 encoder_retrieve_events(&events);
137 EXPECT_EQ(updates[1].index, 4); 167 while (events.tail != events.head) {
138 EXPECT_EQ(updates[1].clockwise, true); 168 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
169 ++events_queued;
170 }
171 EXPECT_EQ(events_queued, 1); // One event should be queued on slave
172}
173
174TEST_F(EncoderSplitTestLeftLessThanRight, TestOneClockwiseRightSlave) {
175 isMaster = false;
176 isLeftHand = false;
177 encoder_init();
178 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
179 setAndRead(6, false);
180 setAndRead(7, false);
181 setAndRead(6, true);
182 setAndRead(7, true);
183
184 EXPECT_EQ(updates_array_idx, 0); // no updates received
185
186 int events_queued = 0;
187 encoder_events_t events;
188 encoder_retrieve_events(&events);
189 while (events.tail != events.head) {
190 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
191 ++events_queued;
192 }
193 EXPECT_EQ(events_queued, 1); // One event should be queued on slave
139} 194}
diff --git a/quantum/encoder/tests/encoder_tests_split_no_left.cpp b/quantum/encoder/tests/encoder_tests_split_no_left.cpp
index b6b2d7e2d1..980e4074ff 100644
--- a/quantum/encoder/tests/encoder_tests_split_no_left.cpp
+++ b/quantum/encoder/tests/encoder_tests_split_no_left.cpp
@@ -33,22 +33,29 @@ struct update {
33uint8_t updates_array_idx = 0; 33uint8_t updates_array_idx = 0;
34update updates[32]; 34update updates[32];
35 35
36bool isMaster;
36bool isLeftHand; 37bool isLeftHand;
37 38
39extern "C" {
40bool is_keyboard_master(void) {
41 return isMaster;
42}
43
38bool encoder_update_kb(uint8_t index, bool clockwise) { 44bool encoder_update_kb(uint8_t index, bool clockwise) {
39 if (!isLeftHand) { 45 if (!is_keyboard_master()) {
40 // this method has no effect on slave half 46 // this method has no effect on slave half
41 printf("ignoring update on right hand (%d,%s)\n", index, clockwise ? "CW" : "CC"); 47 printf("ignoring update on slave (%d,%s)\n", index, clockwise ? "CW" : "CC");
42 return true; 48 return true;
43 } 49 }
44 updates[updates_array_idx % 32] = {index, clockwise}; 50 updates[updates_array_idx % 32] = {index, clockwise};
45 updates_array_idx++; 51 updates_array_idx++;
46 return true; 52 return true;
47} 53}
54};
48 55
49bool setAndRead(pin_t pin, bool val) { 56bool setAndRead(pin_t pin, bool val) {
50 setPin(pin, val); 57 setPin(pin, val);
51 return encoder_read(); 58 return encoder_task();
52} 59}
53 60
54class EncoderSplitTestNoLeft : public ::testing::Test { 61class EncoderSplitTestNoLeft : public ::testing::Test {
@@ -82,19 +89,8 @@ TEST_F(EncoderSplitTestNoLeft, TestInitRight) {
82 EXPECT_EQ(updates_array_idx, 0); // no updates received 89 EXPECT_EQ(updates_array_idx, 0); // no updates received
83} 90}
84 91
85TEST_F(EncoderSplitTestNoLeft, TestOneClockwiseLeft) { 92TEST_F(EncoderSplitTestNoLeft, TestOneClockwiseLeftMaster) {
86 isLeftHand = true; 93 isMaster = true;
87 encoder_init();
88 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
89 setAndRead(0, false);
90 setAndRead(1, false);
91 setAndRead(0, true);
92 setAndRead(1, true);
93
94 EXPECT_EQ(updates_array_idx, 0); // no updates received
95}
96
97TEST_F(EncoderSplitTestNoLeft, TestOneClockwiseRightSent) {
98 isLeftHand = false; 94 isLeftHand = false;
99 encoder_init(); 95 encoder_init();
100 // send 4 pulses. with resolution 4, that's one step and we should get 1 update. 96 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
@@ -103,23 +99,38 @@ TEST_F(EncoderSplitTestNoLeft, TestOneClockwiseRightSent) {
103 setAndRead(2, true); 99 setAndRead(2, true);
104 setAndRead(3, true); 100 setAndRead(3, true);
105 101
106 uint8_t slave_state[32] = {0}; 102 EXPECT_EQ(updates_array_idx, 1); // one update received
107 encoder_state_raw(slave_state); 103 EXPECT_EQ(updates[0].index, 1);
104 EXPECT_EQ(updates[0].clockwise, true);
108 105
109 EXPECT_EQ(slave_state[0], 0); 106 int events_queued = 0;
110 EXPECT_EQ(slave_state[1], 0xFF); 107 encoder_events_t events;
108 encoder_retrieve_events(&events);
109 while (events.tail != events.head) {
110 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
111 ++events_queued;
112 }
113 EXPECT_EQ(events_queued, 0); // No events should be queued on master
111} 114}
112 115
113TEST_F(EncoderSplitTestNoLeft, TestMultipleEncodersRightReceived) { 116TEST_F(EncoderSplitTestNoLeft, TestOneClockwiseRightSlave) {
114 isLeftHand = true; 117 isMaster = false;
118 isLeftHand = false;
115 encoder_init(); 119 encoder_init();
120 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
121 setAndRead(2, false);
122 setAndRead(3, false);
123 setAndRead(2, true);
124 setAndRead(3, true);
116 125
117 uint8_t slave_state[32] = {1, 0xFF}; // First right encoder is CCW, Second right encoder no change, third right encoder CW 126 EXPECT_EQ(updates_array_idx, 0); // no updates received
118 encoder_update_raw(slave_state);
119 127
120 EXPECT_EQ(updates_array_idx, 2); // two updates received, one for each changed item on the right side 128 int events_queued = 0;
121 EXPECT_EQ(updates[0].index, 0); 129 encoder_events_t events;
122 EXPECT_EQ(updates[0].clockwise, false); 130 encoder_retrieve_events(&events);
123 EXPECT_EQ(updates[1].index, 1); 131 while (events.tail != events.head) {
124 EXPECT_EQ(updates[1].clockwise, true); 132 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
133 ++events_queued;
134 }
135 EXPECT_EQ(events_queued, 1); // One event should be queued on slave
125} 136}
diff --git a/quantum/encoder/tests/encoder_tests_split_no_right.cpp b/quantum/encoder/tests/encoder_tests_split_no_right.cpp
index fa0a7c18a8..d39659853b 100644
--- a/quantum/encoder/tests/encoder_tests_split_no_right.cpp
+++ b/quantum/encoder/tests/encoder_tests_split_no_right.cpp
@@ -33,22 +33,29 @@ struct update {
33uint8_t updates_array_idx = 0; 33uint8_t updates_array_idx = 0;
34update updates[32]; 34update updates[32];
35 35
36bool isMaster;
36bool isLeftHand; 37bool isLeftHand;
37 38
39extern "C" {
40bool is_keyboard_master(void) {
41 return isMaster;
42}
43
38bool encoder_update_kb(uint8_t index, bool clockwise) { 44bool encoder_update_kb(uint8_t index, bool clockwise) {
39 if (!isLeftHand) { 45 if (!is_keyboard_master()) {
40 // this method has no effect on slave half 46 // this method has no effect on slave half
41 printf("ignoring update on right hand (%d,%s)\n", index, clockwise ? "CW" : "CC"); 47 printf("ignoring update on slave (%d,%s)\n", index, clockwise ? "CW" : "CC");
42 return true; 48 return true;
43 } 49 }
44 updates[updates_array_idx % 32] = {index, clockwise}; 50 updates[updates_array_idx % 32] = {index, clockwise};
45 updates_array_idx++; 51 updates_array_idx++;
46 return true; 52 return true;
47} 53}
54};
48 55
49bool setAndRead(pin_t pin, bool val) { 56bool setAndRead(pin_t pin, bool val) {
50 setPin(pin, val); 57 setPin(pin, val);
51 return encoder_read(); 58 return encoder_task();
52} 59}
53 60
54class EncoderSplitTestNoRight : public ::testing::Test { 61class EncoderSplitTestNoRight : public ::testing::Test {
@@ -82,37 +89,48 @@ TEST_F(EncoderSplitTestNoRight, TestInitRight) {
82 EXPECT_EQ(updates_array_idx, 0); // no updates received 89 EXPECT_EQ(updates_array_idx, 0); // no updates received
83} 90}
84 91
85TEST_F(EncoderSplitTestNoRight, TestOneClockwiseLeft) { 92TEST_F(EncoderSplitTestNoRight, TestOneClockwiseLeftMaster) {
93 isMaster = true;
86 isLeftHand = true; 94 isLeftHand = true;
87 encoder_init(); 95 encoder_init();
88 // send 4 pulses. with resolution 4, that's one step and we should get 1 update. 96 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
89 setAndRead(0, false); 97 setAndRead(2, false);
90 setAndRead(1, false); 98 setAndRead(3, false);
91 setAndRead(0, true); 99 setAndRead(2, true);
92 setAndRead(1, true); 100 setAndRead(3, true);
93 101
94 EXPECT_EQ(updates_array_idx, 1); // one updates received 102 EXPECT_EQ(updates_array_idx, 1); // one update received
95 EXPECT_EQ(updates[0].index, 0); 103 EXPECT_EQ(updates[0].index, 1);
96 EXPECT_EQ(updates[0].clockwise, true); 104 EXPECT_EQ(updates[0].clockwise, true);
97}
98 105
99TEST_F(EncoderSplitTestNoRight, TestOneClockwiseRightSent) { 106 int events_queued = 0;
100 isLeftHand = false; 107 encoder_events_t events;
101 encoder_init(); 108 encoder_retrieve_events(&events);
102 109 while (events.tail != events.head) {
103 uint8_t slave_state[32] = {0xAA, 0xAA}; 110 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
104 encoder_state_raw(slave_state); 111 ++events_queued;
105 112 }
106 EXPECT_EQ(slave_state[0], 0xAA); 113 EXPECT_EQ(events_queued, 0); // No events should be queued on master
107 EXPECT_EQ(slave_state[1], 0xAA);
108} 114}
109 115
110TEST_F(EncoderSplitTestNoRight, TestMultipleEncodersRightReceived) { 116TEST_F(EncoderSplitTestNoRight, TestOneClockwiseRightSlave) {
117 isMaster = false;
111 isLeftHand = true; 118 isLeftHand = true;
112 encoder_init(); 119 encoder_init();
120 // send 4 pulses. with resolution 4, that's one step and we should get 1 update.
121 setAndRead(2, false);
122 setAndRead(3, false);
123 setAndRead(2, true);
124 setAndRead(3, true);
113 125
114 uint8_t slave_state[32] = {1, 0xFF}; // These values would trigger updates if there were encoders on the other side 126 EXPECT_EQ(updates_array_idx, 0); // no updates received
115 encoder_update_raw(slave_state);
116 127
117 EXPECT_EQ(updates_array_idx, 0); // no updates received -- no right-hand encoders 128 int events_queued = 0;
129 encoder_events_t events;
130 encoder_retrieve_events(&events);
131 while (events.tail != events.head) {
132 events.tail = (events.tail + 1) % MAX_QUEUED_ENCODER_EVENTS;
133 ++events_queued;
134 }
135 EXPECT_EQ(events_queued, 1); // One event should be queued on slave
118} 136}
diff --git a/quantum/encoder/tests/encoder_tests_split_role.cpp b/quantum/encoder/tests/encoder_tests_split_role.cpp
index 0ab7bfc2a7..b588af8c70 100644
--- a/quantum/encoder/tests/encoder_tests_split_role.cpp
+++ b/quantum/encoder/tests/encoder_tests_split_role.cpp
@@ -50,7 +50,7 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
50 50
51bool setAndRead(pin_t pin, bool val) { 51bool setAndRead(pin_t pin, bool val) {
52 setPin(pin, val); 52 setPin(pin, val);
53 return encoder_read(); 53 return encoder_task();
54} 54}
55 55
56class EncoderSplitTestRole : public ::testing::Test { 56class EncoderSplitTestRole : public ::testing::Test {
@@ -87,9 +87,6 @@ TEST_F(EncoderSplitTestRole, TestPrimaryRight) {
87 setAndRead(6, true); 87 setAndRead(6, true);
88 setAndRead(7, true); 88 setAndRead(7, true);
89 89
90 uint8_t slave_state[32] = {0};
91 encoder_state_raw(slave_state);
92
93 EXPECT_EQ(num_updates, 1); // one update received 90 EXPECT_EQ(num_updates, 1); // one update received
94} 91}
95 92
@@ -116,8 +113,5 @@ TEST_F(EncoderSplitTestRole, TestNotPrimaryRight) {
116 setAndRead(6, true); 113 setAndRead(6, true);
117 setAndRead(7, true); 114 setAndRead(7, true);
118 115
119 uint8_t slave_state[32] = {0};
120 encoder_state_raw(slave_state);
121
122 EXPECT_EQ(num_updates, 0); // zero updates received 116 EXPECT_EQ(num_updates, 0); // zero updates received
123} 117}
diff --git a/quantum/encoder/tests/mock_split.c b/quantum/encoder/tests/mock_split.c
index f024c2058d..fb5f074fbb 100644
--- a/quantum/encoder/tests/mock_split.c
+++ b/quantum/encoder/tests/mock_split.c
@@ -36,7 +36,3 @@ bool setPin(pin_t pin, bool val) {
36} 36}
37 37
38void last_encoder_activity_trigger(void) {} 38void last_encoder_activity_trigger(void) {}
39
40__attribute__((weak)) bool is_keyboard_master(void) {
41 return true;
42}
diff --git a/quantum/encoder/tests/mock_split.h b/quantum/encoder/tests/mock_split.h
index 8b4a141078..0d108afa6e 100644
--- a/quantum/encoder/tests/mock_split.h
+++ b/quantum/encoder/tests/mock_split.h
@@ -22,9 +22,6 @@
22#define SPLIT_KEYBOARD 22#define SPLIT_KEYBOARD
23typedef uint8_t pin_t; 23typedef uint8_t pin_t;
24 24
25void encoder_state_raw(uint8_t* slave_state);
26void encoder_update_raw(uint8_t* slave_state);
27
28extern bool pins[]; 25extern bool pins[];
29extern bool pinIsInputHigh[]; 26extern bool pinIsInputHigh[];
30 27
diff --git a/quantum/encoder/tests/rules.mk b/quantum/encoder/tests/rules.mk
index d01c1c66ee..eb6106039e 100644
--- a/quantum/encoder/tests/rules.mk
+++ b/quantum/encoder/tests/rules.mk
@@ -3,6 +3,7 @@ encoder_CONFIG := $(QUANTUM_PATH)/encoder/tests/config_mock.h
3 3
4encoder_SRC := \ 4encoder_SRC := \
5 platforms/test/timer.c \ 5 platforms/test/timer.c \
6 drivers/encoder/encoder_quadrature.c \
6 $(QUANTUM_PATH)/encoder/tests/mock.c \ 7 $(QUANTUM_PATH)/encoder/tests/mock.c \
7 $(QUANTUM_PATH)/encoder/tests/encoder_tests.cpp \ 8 $(QUANTUM_PATH)/encoder/tests/encoder_tests.cpp \
8 $(QUANTUM_PATH)/encoder.c 9 $(QUANTUM_PATH)/encoder.c
@@ -13,6 +14,7 @@ encoder_split_left_eq_right_CONFIG := $(QUANTUM_PATH)/encoder/tests/config_mock_
13 14
14encoder_split_left_eq_right_SRC := \ 15encoder_split_left_eq_right_SRC := \
15 platforms/test/timer.c \ 16 platforms/test/timer.c \
17 drivers/encoder/encoder_quadrature.c \
16 $(QUANTUM_PATH)/encoder/tests/mock_split.c \ 18 $(QUANTUM_PATH)/encoder/tests/mock_split.c \
17 $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_left_eq_right.cpp \ 19 $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_left_eq_right.cpp \
18 $(QUANTUM_PATH)/encoder.c 20 $(QUANTUM_PATH)/encoder.c
@@ -23,6 +25,7 @@ encoder_split_left_gt_right_CONFIG := $(QUANTUM_PATH)/encoder/tests/config_mock_
23 25
24encoder_split_left_gt_right_SRC := \ 26encoder_split_left_gt_right_SRC := \
25 platforms/test/timer.c \ 27 platforms/test/timer.c \
28 drivers/encoder/encoder_quadrature.c \
26 $(QUANTUM_PATH)/encoder/tests/mock_split.c \ 29 $(QUANTUM_PATH)/encoder/tests/mock_split.c \
27 $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_left_gt_right.cpp \ 30 $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_left_gt_right.cpp \
28 $(QUANTUM_PATH)/encoder.c 31 $(QUANTUM_PATH)/encoder.c
@@ -33,6 +36,7 @@ encoder_split_left_lt_right_CONFIG := $(QUANTUM_PATH)/encoder/tests/config_mock_
33 36
34encoder_split_left_lt_right_SRC := \ 37encoder_split_left_lt_right_SRC := \
35 platforms/test/timer.c \ 38 platforms/test/timer.c \
39 drivers/encoder/encoder_quadrature.c \
36 $(QUANTUM_PATH)/encoder/tests/mock_split.c \ 40 $(QUANTUM_PATH)/encoder/tests/mock_split.c \
37 $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_left_lt_right.cpp \ 41 $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_left_lt_right.cpp \
38 $(QUANTUM_PATH)/encoder.c 42 $(QUANTUM_PATH)/encoder.c
@@ -43,6 +47,7 @@ encoder_split_no_left_CONFIG := $(QUANTUM_PATH)/encoder/tests/config_mock_split_
43 47
44encoder_split_no_left_SRC := \ 48encoder_split_no_left_SRC := \
45 platforms/test/timer.c \ 49 platforms/test/timer.c \
50 drivers/encoder/encoder_quadrature.c \
46 $(QUANTUM_PATH)/encoder/tests/mock_split.c \ 51 $(QUANTUM_PATH)/encoder/tests/mock_split.c \
47 $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_no_left.cpp \ 52 $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_no_left.cpp \
48 $(QUANTUM_PATH)/encoder.c 53 $(QUANTUM_PATH)/encoder.c
@@ -53,6 +58,7 @@ encoder_split_no_right_CONFIG := $(QUANTUM_PATH)/encoder/tests/config_mock_split
53 58
54encoder_split_no_right_SRC := \ 59encoder_split_no_right_SRC := \
55 platforms/test/timer.c \ 60 platforms/test/timer.c \
61 drivers/encoder/encoder_quadrature.c \
56 $(QUANTUM_PATH)/encoder/tests/mock_split.c \ 62 $(QUANTUM_PATH)/encoder/tests/mock_split.c \
57 $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_no_right.cpp \ 63 $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_no_right.cpp \
58 $(QUANTUM_PATH)/encoder.c 64 $(QUANTUM_PATH)/encoder.c
@@ -63,6 +69,7 @@ encoder_split_role_CONFIG := $(QUANTUM_PATH)/encoder/tests/config_mock_split_rol
63 69
64encoder_split_role_SRC := \ 70encoder_split_role_SRC := \
65 platforms/test/timer.c \ 71 platforms/test/timer.c \
72 drivers/encoder/encoder_quadrature.c \
66 $(QUANTUM_PATH)/encoder/tests/mock_split.c \ 73 $(QUANTUM_PATH)/encoder/tests/mock_split.c \
67 $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_role.cpp \ 74 $(QUANTUM_PATH)/encoder/tests/encoder_tests_split_role.cpp \
68 $(QUANTUM_PATH)/encoder.c 75 $(QUANTUM_PATH)/encoder.c