diff --git a/right/src/usb_interface_keyboard.c b/right/src/usb_interface_keyboard.c index ee3b34b..4cb3fbe 100644 --- a/right/src/usb_interface_keyboard.c +++ b/right/src/usb_interface_keyboard.c @@ -70,41 +70,20 @@ static usb_status_t UsbKeyboardAction(void) UsbKeyboardReport.reserved = 0; KeyMatrix_Init(&keyMatrix); - //KeyMatrix_Scan(&keyMatrix); + KeyMatrix_Scan(&keyMatrix); - for (uint8_t scancode_idx=0; scancode_idxcolNum; col++) { GPIO_WritePinOutput(keyMatrix->cols[col].gpio, keyMatrix->cols[col].pin, 1); for (uint8_t row=0; rowrowNum; row++) { - keyMatrix->keyStates[keyId++] = GPIO_ReadPinInput(keyMatrix->rows[row].gpio, keyMatrix->rows[row].pin); + keyMatrix->keyStates[row*keyMatrix->colNum + col] = GPIO_ReadPinInput(keyMatrix->rows[row].gpio, keyMatrix->rows[row].pin); } GPIO_WritePinOutput(keyMatrix->cols[col].gpio, keyMatrix->cols[col].pin, 0); + for (volatile uint32_t i=0; i<100; i++); // Wait for the new port state to settle. This avoid bogus key state detection. } }