Fix call to memset for various keyboards

This commit is contained in:
Kaleb Elwert 2018-01-10 13:15:06 -08:00 committed by Jack Humbert
parent 586a5e8d1d
commit 3be81a2daf
6 changed files with 42 additions and 41 deletions

View File

@ -11,7 +11,7 @@
/* Clueboard 60% /* Clueboard 60%
* *
* Column pins are input with internal pull-down. * Column pins are input with internal pull-down.
* Row pins are output and strobe with high. * Row pins are output and strobe with high.
* Key is high or 1 when it turns on. * Key is high or 1 when it turns on.
* *
@ -68,8 +68,8 @@ void matrix_init(void) {
palSetPadMode(GPIOA, 15, PAL_MODE_INPUT_PULLDOWN); palSetPadMode(GPIOA, 15, PAL_MODE_INPUT_PULLDOWN);
palSetPadMode(GPIOA, 10, PAL_MODE_INPUT_PULLDOWN); palSetPadMode(GPIOA, 10, PAL_MODE_INPUT_PULLDOWN);
memset(matrix, 0, MATRIX_ROWS); memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
memset(matrix_debouncing, 0, MATRIX_COLS); memset(matrix_debouncing, 0, MATRIX_COLS * sizeof(matrix_row_t));
/* Setup capslock */ /* Setup capslock */
// palSetPadMode(GPIOB, 7, PAL_MODE_OUTPUT_PUSHPULL); // palSetPadMode(GPIOB, 7, PAL_MODE_OUTPUT_PUSHPULL);
@ -84,20 +84,20 @@ uint8_t matrix_scan(void) {
// strobe col { PA2, PA3, PA6, PB14, PB15, PA8, PA9, PA7, PB3, PB4, PC14, PC15, PC13, PB5, PB6 } // strobe col { PA2, PA3, PA6, PB14, PB15, PA8, PA9, PA7, PB3, PB4, PC14, PC15, PC13, PB5, PB6 }
switch (col) { switch (col) {
case 0: palSetPad(GPIOA, 2); break; case 0: palSetPad(GPIOA, 2); break;
case 1: palSetPad(GPIOA, 3); break; case 1: palSetPad(GPIOA, 3); break;
case 2: palSetPad(GPIOA, 6); break; case 2: palSetPad(GPIOA, 6); break;
case 3: palSetPad(GPIOB, 14); break; case 3: palSetPad(GPIOB, 14); break;
case 4: palSetPad(GPIOB, 15); break; case 4: palSetPad(GPIOB, 15); break;
case 5: palSetPad(GPIOA, 8); break; case 5: palSetPad(GPIOA, 8); break;
case 6: palSetPad(GPIOA, 9); break; case 6: palSetPad(GPIOA, 9); break;
case 7: palSetPad(GPIOA, 7); break; case 7: palSetPad(GPIOA, 7); break;
case 8: palSetPad(GPIOB, 3); break; case 8: palSetPad(GPIOB, 3); break;
case 9: palSetPad(GPIOB, 4); break; case 9: palSetPad(GPIOB, 4); break;
case 10: palSetPad(GPIOC, 15); break; case 10: palSetPad(GPIOC, 15); break;
case 11: palSetPad(GPIOC, 14); break; case 11: palSetPad(GPIOC, 14); break;
case 12: palSetPad(GPIOC, 13); break; case 12: palSetPad(GPIOC, 13); break;
case 13: palSetPad(GPIOB, 5); break; case 13: palSetPad(GPIOB, 5); break;
case 14: palSetPad(GPIOB, 6); break; case 14: palSetPad(GPIOB, 6); break;
} }
@ -115,20 +115,20 @@ uint8_t matrix_scan(void) {
// unstrobe col { PA2, PA3, PA6, PB14, PB15, PA8, PA9, PA7, PB3, PB4, PC15, PC14, PC13, PB5, PB6 } // unstrobe col { PA2, PA3, PA6, PB14, PB15, PA8, PA9, PA7, PB3, PB4, PC15, PC14, PC13, PB5, PB6 }
switch (col) { switch (col) {
case 0: palClearPad(GPIOA, 2); break; case 0: palClearPad(GPIOA, 2); break;
case 1: palClearPad(GPIOA, 3); break; case 1: palClearPad(GPIOA, 3); break;
case 2: palClearPad(GPIOA, 6); break; case 2: palClearPad(GPIOA, 6); break;
case 3: palClearPad(GPIOB, 14); break; case 3: palClearPad(GPIOB, 14); break;
case 4: palClearPad(GPIOB, 15); break; case 4: palClearPad(GPIOB, 15); break;
case 5: palClearPad(GPIOA, 8); break; case 5: palClearPad(GPIOA, 8); break;
case 6: palClearPad(GPIOA, 9); break; case 6: palClearPad(GPIOA, 9); break;
case 7: palClearPad(GPIOA, 7); break; case 7: palClearPad(GPIOA, 7); break;
case 8: palClearPad(GPIOB, 3); break; case 8: palClearPad(GPIOB, 3); break;
case 9: palClearPad(GPIOB, 4); break; case 9: palClearPad(GPIOB, 4); break;
case 10: palClearPad(GPIOC, 15); break; case 10: palClearPad(GPIOC, 15); break;
case 11: palClearPad(GPIOC, 14); break; case 11: palClearPad(GPIOC, 14); break;
case 12: palClearPad(GPIOC, 13); break; case 12: palClearPad(GPIOC, 13); break;
case 13: palClearPad(GPIOB, 5); break; case 13: palClearPad(GPIOB, 5); break;
case 14: palClearPad(GPIOB, 6); break; case 14: palClearPad(GPIOB, 6); break;
} }

View File

@ -62,8 +62,8 @@ void matrix_init(void)
palSetPadMode(GPIOC, 11, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOC, 11, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL);
memset(matrix, 0, MATRIX_ROWS); memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
memset(matrix_debouncing, 0, LOCAL_MATRIX_ROWS); memset(matrix_debouncing, 0, LOCAL_MATRIX_ROWS * sizeof(matrix_row_t));
matrix_init_quantum(); matrix_init_quantum();
} }

View File

@ -60,8 +60,8 @@ void matrix_init(void)
palSetPadMode(GPIOC, 5, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOC, 5, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL);
#endif #endif
memset(matrix, 0, MATRIX_ROWS); memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
memset(matrix_debouncing, 0, MATRIX_ROWS); memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t));
matrix_init_quantum(); matrix_init_quantum();
} }

View File

@ -49,8 +49,8 @@ void matrix_init(void)
palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL);
memset(matrix, 0, MATRIX_ROWS); memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
memset(matrix_debouncing, 0, MATRIX_ROWS); memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t));
} }
uint8_t matrix_scan(void) uint8_t matrix_scan(void)

View File

@ -42,8 +42,8 @@ void matrix_init(void)
palSetPadMode(GPIOD, 1, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOD, 1, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOD, 4, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOD, 4, PAL_MODE_OUTPUT_PUSHPULL);
memset(matrix, 0, MATRIX_ROWS); memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
memset(matrix_debouncing, 0, MATRIX_ROWS); memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t));
matrix_init_quantum(); matrix_init_quantum();
} }

View File

@ -47,8 +47,9 @@ void matrix_init(void)
palSetPadMode(GPIOC, 10, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOC, 10, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 11, PAL_MODE_OUTPUT_PUSHPULL); palSetPadMode(GPIOC, 11, PAL_MODE_OUTPUT_PUSHPULL);
memset(matrix, 0, MATRIX_ROWS); memset(matrix, 0, MATRIX_ROWS * sizeof(matrix_row_t));
memset(matrix_debouncing, 0, MATRIX_ROWS); memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t));
matrix_init_quantum(); matrix_init_quantum();
} }