Add CurrentKeyStates and PreviousKeyStates globals and use them across the whole codebase.

This commit is contained in:
László Monda
2017-01-03 01:09:00 +01:00
parent 3942d089de
commit 2457f3b0e0
6 changed files with 28 additions and 20 deletions

View File

@@ -51,16 +51,16 @@ void UsbKeyboadTask()
UsbKeyboardReport[newReportIndex].reserved = 0;
KeyMatrix_Scan(&KeyMatrix);
memcpy(CurrentKeyStates[SLOT_ID_RIGHT_KEYBOARD_HALF], KeyMatrix.keyStates, MAX_KEY_COUNT_PER_MODULE);
uint8_t txData[] = {0};
static uint8_t leftKeyStates[KEY_STATE_COUNT];
bzero(leftKeyStates, KEY_STATE_COUNT);
bzero(CurrentKeyStates[SLOT_ID_LEFT_KEYBOARD_HALF], MAX_KEY_COUNT_PER_MODULE);
if (I2cWrite(I2C_MAIN_BUS_BASEADDR, I2C_ADDRESS_LEFT_KEYBOARD_HALF, txData, sizeof(txData)) == kStatus_Success) {
I2cRead(I2C_MAIN_BUS_BASEADDR, I2C_ADDRESS_LEFT_KEYBOARD_HALF, leftKeyStates, KEY_STATE_COUNT);
I2cRead(I2C_MAIN_BUS_BASEADDR, I2C_ADDRESS_LEFT_KEYBOARD_HALF, CurrentKeyStates[SLOT_ID_LEFT_KEYBOARD_HALF], LEFT_KEYBOARD_HALF_KEY_COUNT);
}
bzero(&UsbKeyboardReport[newReportIndex].scancodes, USB_KEYBOARD_MAX_KEYS);
HandleKeyboardEvents(&UsbKeyboardReport[newReportIndex], &UsbMouseReport, leftKeyStates, KeyMatrix.keyStates);
HandleKeyboardEvents(&UsbKeyboardReport[newReportIndex], &UsbMouseReport);
activeReportIndex = newReportIndex;
}