Skip to content

Commit a4b6fe0

Browse files
fdidrondrashna
andauthored
fix issues with keyboard sleep (qmk#316)
Co-authored-by: Drashna Jael're <drashna@live.com>
1 parent edd5825 commit a4b6fe0

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

keyboards/ergodox_ez/matrix.c

+15
Original file line numberDiff line numberDiff line change
@@ -321,3 +321,18 @@ static void select_row(uint8_t row) {
321321
}
322322
}
323323
}
324+
325+
// DO NOT REMOVE
326+
// Needed for proper wake/sleep
327+
void matrix_power_up(void) {
328+
mcp23018_status = init_mcp23018();
329+
330+
unselect_rows();
331+
init_cols();
332+
333+
// initialize matrix state: all keys off
334+
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
335+
matrix[i] = 0;
336+
}
337+
338+
}

keyboards/moonlander/matrix.c

+35
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,38 @@ void matrix_print(void) {
259259
printf("\n");
260260
}
261261
}
262+
263+
// DO NOT REMOVE
264+
// Needed for proper wake/sleep
265+
266+
void matrix_power_up(void) {
267+
mcp23018_init();
268+
269+
// outputs
270+
setPinOutput(B10);
271+
setPinOutput(B11);
272+
setPinOutput(B12);
273+
setPinOutput(B13);
274+
setPinOutput(B14);
275+
setPinOutput(B15);
276+
277+
// inputs
278+
setPinInputLow(A0);
279+
setPinInputLow(A1);
280+
setPinInputLow(A2);
281+
setPinInputLow(A3);
282+
setPinInputLow(A6);
283+
setPinInputLow(A7);
284+
setPinInputLow(B0);
285+
286+
memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
287+
memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t));
288+
memset(matrix_debouncing_right, 0, MATRIX_COLS * sizeof(matrix_row_t));
289+
290+
291+
// initialize matrix state: all keys off
292+
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
293+
matrix[i] = 0;
294+
}
295+
296+
}

0 commit comments

Comments
 (0)