From a4b6fe0b23bb73bb7b4f58f5a74bb8e470f08b99 Mon Sep 17 00:00:00 2001 From: Florian Didron Date: Wed, 14 Oct 2020 10:46:53 +0900 Subject: fix issues with keyboard sleep (#316) Co-authored-by: Drashna Jael're --- keyboards/moonlander/matrix.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'keyboards/moonlander') 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; + } + +} -- cgit v1.2.3