summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2020-01-19 14:11:57 +1100
committerFlorian Didron <fdidron@users.noreply.github.com>2020-02-26 10:15:12 +0900
commitc3dbc8831f50cf58d12e94a511017b867955142b (patch)
tree43e9c2b0d601fe14fdbfea8dcebe8d99950f39f0 /quantum
parent5b6592f616b77f0be0146f2c7f4b6198f06516bd (diff)
Enforce definition of `DIODE_DIRECTION` for non-custom matrix boards (#7915)
* Enforce definition of `DIODE_DIRECTION` for non-custom matrix boards * Define diode direction for failing boards * Matching parentheses * Put onekey diode directions in top level config
Diffstat (limited to 'quantum')
-rw-r--r--quantum/matrix.c10
-rw-r--r--quantum/split_common/matrix.c10
2 files changed, 16 insertions, 4 deletions
diff --git a/quantum/matrix.c b/quantum/matrix.c
index 1675f2477b..6bd604bb79 100644
--- a/quantum/matrix.c
+++ b/quantum/matrix.c
@@ -62,7 +62,8 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
return (last_row_value != current_matrix[current_row]);
}
-#elif (DIODE_DIRECTION == COL2ROW)
+#elif defined(DIODE_DIRECTION)
+# if (DIODE_DIRECTION == COL2ROW)
static void select_row(uint8_t row) {
setPinOutput(row_pins[row]);
@@ -110,7 +111,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
return (last_row_value != current_matrix[current_row]);
}
-#elif (DIODE_DIRECTION == ROW2COL)
+# elif (DIODE_DIRECTION == ROW2COL)
static void select_col(uint8_t col) {
setPinOutput(col_pins[col]);
@@ -165,6 +166,11 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
return matrix_changed;
}
+# else
+# error DIODE_DIRECTION must be one of COL2ROW or ROW2COL!
+# endif
+#else
+# error DIODE_DIRECTION is not defined!
#endif
void matrix_init(void) {
diff --git a/quantum/split_common/matrix.c b/quantum/split_common/matrix.c
index ed1ff5acf3..454ea59c3b 100644
--- a/quantum/split_common/matrix.c
+++ b/quantum/split_common/matrix.c
@@ -79,7 +79,8 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
return (last_row_value != current_matrix[current_row]);
}
-#elif (DIODE_DIRECTION == COL2ROW)
+#elif defined(DIODE_DIRECTION)
+# if (DIODE_DIRECTION == COL2ROW)
static void select_row(uint8_t row) {
setPinOutput(row_pins[row]);
@@ -124,7 +125,7 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
return (last_row_value != current_matrix[current_row]);
}
-#elif (DIODE_DIRECTION == ROW2COL)
+# elif (DIODE_DIRECTION == ROW2COL)
static void select_col(uint8_t col) {
setPinOutput(col_pins[col]);
@@ -179,6 +180,11 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
return matrix_changed;
}
+# else
+# error DIODE_DIRECTION must be one of COL2ROW or ROW2COL!
+# endif
+#else
+# error DIODE_DIRECTION is not defined!
#endif
void matrix_init(void) {