1
0

Update matrix.c

This commit is contained in:
di0ib 2018-04-14 08:53:59 -10:00 committed by GitHub
parent 8168810036
commit 8ac3b382d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,6 +70,9 @@ uint8_t matrix_cols(void)
void matrix_init(void) void matrix_init(void)
{ {
// disable JTAG SWD
AFIO->MAPR = AFIO_MAPR_SWJ_CFG_DISABLE;
// initialize row and col // initialize row and col
unselect_rows(); unselect_rows();
init_cols(); init_cols();
@ -144,16 +147,16 @@ static void init_cols(void)
{ {
palSetPadMode(GPIOB, 11, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOB, 11, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOB, 10, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOB, 10, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOB, 2, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOB, 2, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOB, 0, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOB, 0, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOA, 7, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOA, 7, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOA, 6, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOA, 6, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOA, 5, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOA, 5, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOA, 4, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOA, 4, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOA, 3, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOA, 3, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOA, 2, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOA, 2, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOA, 1, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOA, 1, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOA, 0, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOA, 0, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOC, 15, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOC, 15, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOC, 14, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOC, 14, PAL_MODE_INPUT_PULLUP);
palSetPadMode(GPIOC, 13, PAL_MODE_INPUT_PULLUP); palSetPadMode(GPIOC, 13, PAL_MODE_INPUT_PULLUP);
@ -174,9 +177,9 @@ static matrix_row_t read_cols(void)
| ((palReadPad(GPIOA, 2)==PAL_HIGH) ? 0 : (1<<9)) | ((palReadPad(GPIOA, 2)==PAL_HIGH) ? 0 : (1<<9))
| ((palReadPad(GPIOA, 1)==PAL_HIGH) ? 0 : (1<<10)) | ((palReadPad(GPIOA, 1)==PAL_HIGH) ? 0 : (1<<10))
| ((palReadPad(GPIOA, 0)==PAL_HIGH) ? 0 : (1<<11)) | ((palReadPad(GPIOA, 0)==PAL_HIGH) ? 0 : (1<<11))
| ((palReadPad(GPIOC, 15)==PAL_HIGH) ? 0 : (1<<12)) | ((palReadPad(GPIOC, 15)==PAL_HIGH) ? 0 : (1<<12))
| ((palReadPad(GPIOC, 14)==PAL_HIGH) ? 0 : (1<<13)) | ((palReadPad(GPIOC, 14)==PAL_HIGH) ? 0 : (1<<13))
| ((palReadPad(GPIOC, 13)==PAL_HIGH) ? 0 : (1<<14)); | ((palReadPad(GPIOC, 13)==PAL_HIGH) ? 0 : (1<<14));
} }
/* Row pin configuration /* Row pin configuration