diff --git a/lib/agent b/lib/agent index f94b221..1eb8720 160000 --- a/lib/agent +++ b/lib/agent @@ -1 +1 @@ -Subproject commit f94b221ee98c589b6c694fa627cfc92727e9e9c0 +Subproject commit 1eb87203059447db676e96fdcef106c4b314e5c6 diff --git a/shared/key_matrix.c b/shared/key_matrix.c index c34a409..67b45ee 100644 --- a/shared/key_matrix.c +++ b/shared/key_matrix.c @@ -24,19 +24,19 @@ void KeyMatrix_ScanRow(key_matrix_t *keyMatrix) { uint8_t *keyState = keyMatrix->keyStates + keyMatrix->currentRowNum * keyMatrix->colNum; key_matrix_pin_t *row = keyMatrix->rows + keyMatrix->currentRowNum; - GPIO_Type *rowGpio = row->gpio; - uint32_t rowPin = row->pin; - - GPIO_WritePinOutput(rowGpio, rowPin, 1); key_matrix_pin_t *colEnd = keyMatrix->cols + keyMatrix->colNum; for (key_matrix_pin_t *col = keyMatrix->cols; colgpio, col->pin); } - GPIO_WritePinOutput(rowGpio, rowPin, 0); + GPIO_WritePinOutput(row->gpio, row->pin, 0); if (++keyMatrix->currentRowNum >= keyMatrix->rowNum) { keyMatrix->currentRowNum = 0; } + + // This should come last to maintain the strobe for as long as possible to minimize the chance of chatter. + row = keyMatrix->rows + keyMatrix->currentRowNum; + GPIO_WritePinOutput(row->gpio, row->pin, 1); }