Implement disabling keyboard matrix scanning for the left keyboard half, too.

This commit is contained in:
László Monda
2017-04-30 03:39:27 +02:00
parent fef5deea4a
commit 14225a9ba9
8 changed files with 25 additions and 7 deletions

View File

@@ -4,6 +4,7 @@
#include "bridge_protocol.h"
#include "main.h"
#include "peripherals/test_led.h"
#include "test_states.h"
uhk_module_state_t UhkModuleStates[UHK_MODULE_MAX_COUNT];
uhk_module_field_t currentUhkModuleField = UhkModuleField_SendKeystatesRequestCommand;
@@ -44,6 +45,12 @@ bool BridgeSlaveUhkModuleHandler(uint8_t uhkModuleId)
txBuffer[0] = BridgeCommand_SetTestLed;
txBuffer[1] = uhkModuleInternalState->isTestLedOn;
I2cAsyncWrite(I2C_ADDRESS_LEFT_KEYBOARD_HALF, txBuffer, 2);
currentUhkModuleField = UhkModuleField_SendDisableKeyMatrixScanState;
break;
case UhkModuleField_SendDisableKeyMatrixScanState:
txBuffer[0] = BridgeCommand_SetDisableKeyMatrixScanState;
txBuffer[1] = TestStates.disableKeyMatrixScan;
I2cAsyncWrite(I2C_ADDRESS_LEFT_KEYBOARD_HALF, txBuffer, 2);
currentUhkModuleField = UhkModuleField_SendKeystatesRequestCommand;
break;
}

View File

@@ -16,6 +16,7 @@
UhkModuleField_ReceiveKeystates,
UhkModuleField_SendPwmBrightnessCommand,
UhkModuleField_SendTestLedCommand,
UhkModuleField_SendDisableKeyMatrixScanState,
} uhk_module_field_t;
typedef struct {

View File

@@ -12,6 +12,7 @@
#include "bus_pal_hardware.h"
#include "bootloader_config.h"
#include "command.h"
#include "test_states.h"
key_matrix_t KeyMatrix = {
.colNum = KEYBOARD_MATRIX_COLS_NUM,
@@ -75,7 +76,10 @@ void UpdateUsbReports()
ResetActiveUsbMediaKeyboardReport();
ResetActiveUsbSystemKeyboardReport();
KeyMatrix_Scan(&KeyMatrix);
if (!TestStates.disableKeyMatrixScan) {
KeyMatrix_Scan(&KeyMatrix);
}
memcpy(CurrentKeyStates[SLOT_ID_RIGHT_KEYBOARD_HALF], KeyMatrix.keyStates, MAX_KEY_COUNT_PER_MODULE);
UpdateActiveUsbReports();