summaryrefslogtreecommitdiff
path: root/keyboards
diff options
context:
space:
mode:
authorFlorian Didron <fdidron@users.noreply.github.com>2020-10-14 10:46:53 +0900
committerGitHub <noreply@github.com>2020-10-14 10:46:53 +0900
commita4b6fe0b23bb73bb7b4f58f5a74bb8e470f08b99 (patch)
tree13d867654cf8c727698d18476ebc49332265aef9 /keyboards
parentedd58256f58b44b00f8ae811941c63862693e4c4 (diff)
fix issues with keyboard sleep (#316)
Co-authored-by: Drashna Jael're <drashna@live.com>
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/ergodox_ez/matrix.c15
-rw-r--r--keyboards/moonlander/matrix.c35
2 files changed, 50 insertions, 0 deletions
diff --git a/keyboards/ergodox_ez/matrix.c b/keyboards/ergodox_ez/matrix.c
index 18c576060d..7647ee912b 100644
--- a/keyboards/ergodox_ez/matrix.c
+++ b/keyboards/ergodox_ez/matrix.c
@@ -321,3 +321,18 @@ static void select_row(uint8_t row) {
}
}
}
+
+// DO NOT REMOVE
+// Needed for proper wake/sleep
+void matrix_power_up(void) {
+ mcp23018_status = init_mcp23018();
+
+ unselect_rows();
+ init_cols();
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ }
+
+}
diff --git a/keyboards/moonlander/matrix.c b/keyboards/moonlander/matrix.c
index e5b9b81a2e..a67a091705 100644
--- a/keyboards/moonlander/matrix.c
+++ b/keyboards/moonlander/matrix.c
@@ -259,3 +259,38 @@ void matrix_print(void) {
printf("\n");
}
}
+
+// DO NOT REMOVE
+// Needed for proper wake/sleep
+
+void matrix_power_up(void) {
+ mcp23018_init();
+
+ // outputs
+ setPinOutput(B10);
+ setPinOutput(B11);
+ setPinOutput(B12);
+ setPinOutput(B13);
+ setPinOutput(B14);
+ setPinOutput(B15);
+
+ // inputs
+ setPinInputLow(A0);
+ setPinInputLow(A1);
+ setPinInputLow(A2);
+ setPinInputLow(A3);
+ setPinInputLow(A6);
+ setPinInputLow(A7);
+ setPinInputLow(B0);
+
+ memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
+ memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t));
+ memset(matrix_debouncing_right, 0, MATRIX_COLS * sizeof(matrix_row_t));
+
+
+ // initialize matrix state: all keys off
+ for (uint8_t i=0; i < MATRIX_ROWS; i++) {
+ matrix[i] = 0;
+ }
+
+}