aboutsummaryrefslogtreecommitdiff
path: root/keyboards/preonic/rev3/matrix.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/preonic/rev3/matrix.c')
-rw-r--r--keyboards/preonic/rev3/matrix.c22
1 files changed, 0 insertions, 22 deletions
diff --git a/keyboards/preonic/rev3/matrix.c b/keyboards/preonic/rev3/matrix.c
index 05f6da71b..db7a4f2a3 100644
--- a/keyboards/preonic/rev3/matrix.c
+++ b/keyboards/preonic/rev3/matrix.c
@@ -21,10 +21,6 @@ static matrix_col_t matrix_debouncing[MATRIX_COLS];
21static bool debouncing = false; 21static bool debouncing = false;
22static uint16_t debouncing_time = 0; 22static uint16_t debouncing_time = 0;
23 23
24static uint8_t encoder_state = 0;
25static int8_t encoder_value = 0;
26static int8_t encoder_LUT[] = { 0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0 };
27
28static bool dip_switch[4] = {0, 0, 0, 0}; 24static bool dip_switch[4] = {0, 0, 0, 0};
29 25
30__attribute__ ((weak)) 26__attribute__ ((weak))
@@ -53,12 +49,6 @@ void matrix_init(void) {
53 palSetPadMode(GPIOA, 10, PAL_MODE_INPUT_PULLUP); 49 palSetPadMode(GPIOA, 10, PAL_MODE_INPUT_PULLUP);
54 palSetPadMode(GPIOB, 9, PAL_MODE_INPUT_PULLUP); 50 palSetPadMode(GPIOB, 9, PAL_MODE_INPUT_PULLUP);
55 51
56 // encoder setup
57 palSetPadMode(GPIOB, 12, PAL_MODE_INPUT_PULLUP);
58 palSetPadMode(GPIOB, 13, PAL_MODE_INPUT_PULLUP);
59
60 encoder_state = (palReadPad(GPIOB, 12) << 0) | (palReadPad(GPIOB, 13) << 1);
61
62 // actual matrix setup 52 // actual matrix setup
63 palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL); 53 palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL);
64 palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL); 54 palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL);
@@ -110,18 +100,6 @@ uint8_t matrix_scan(void) {
110 } 100 }
111 memcpy(last_dip_switch, dip_switch, sizeof(&dip_switch)); 101 memcpy(last_dip_switch, dip_switch, sizeof(&dip_switch));
112 102
113 // encoder on B12 and B13
114 encoder_state <<= 2;
115 encoder_state |= (palReadPad(GPIOB, 12) << 0) | (palReadPad(GPIOB, 13) << 1);
116 encoder_value += encoder_LUT[encoder_state & 0xF];
117 if (encoder_value >= ENCODER_RESOLUTION) {
118 encoder_update(0);
119 }
120 if (encoder_value <= -ENCODER_RESOLUTION) { // direction is arbitrary here, but this clockwise
121 encoder_update(1);
122 }
123 encoder_value %= ENCODER_RESOLUTION;
124
125 // actual matrix 103 // actual matrix
126 for (int col = 0; col < MATRIX_COLS; col++) { 104 for (int col = 0; col < MATRIX_COLS; col++) {
127 matrix_col_t data = 0; 105 matrix_col_t data = 0;