Update USB reports from the main loop instead of the callback of the USB keyboard interface.

This commit is contained in:
László Monda
2017-02-26 11:10:04 +01:00
parent 657431e130
commit 8b46810643
3 changed files with 17 additions and 5 deletions

View File

@@ -7,6 +7,7 @@
#include "action.h"
#include "bridge_protocol_scheduler.h"
#include "peripherials/test_led.h"
#include "usb_interfaces/usb_interface_keyboard.h"
key_matrix_t KeyMatrix = {
.colNum = KEYBOARD_MATRIX_COLS_NUM,
@@ -62,11 +63,17 @@ static const uint8_t testData[] =
void UpdateUsbReports()
{
if (!IsUsbKeyboardReportSent) {
return;
}
ResetActiveUsbKeyboardReport();
KeyMatrix_Scan(&KeyMatrix);
memcpy(CurrentKeyStates[SLOT_ID_RIGHT_KEYBOARD_HALF], KeyMatrix.keyStates, MAX_KEY_COUNT_PER_MODULE);
UpdateActiveUsbReports();
SwitchActiveUsbKeyboardReport();
IsUsbKeyboardReportSent = false;
}
void main() {
@@ -75,13 +82,13 @@ void main() {
LedDriver_InitAllLeds(1);
InitBridgeProtocolScheduler();
KeyMatrix_Init(&KeyMatrix);
//UpdateUsbReports();
UpdateUsbReports();
InitUsb();
// deserialize_Layer(testData, 0);
while (1) {
//UpdateUsbReports();
UpdateUsbReports();
asm("wfi");
}
}