Implement disabling keyboard matrix scanning for the left keyboard half, too.
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "led_pwm.h"
|
#include "led_pwm.h"
|
||||||
#include "bridge_protocol.h"
|
#include "bridge_protocol.h"
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
void SetError(uint8_t error);
|
void SetError(uint8_t error);
|
||||||
void SetGenericError();
|
void SetGenericError();
|
||||||
@@ -43,5 +44,9 @@ void BridgeProtocolHandler()
|
|||||||
uint8_t brightnessPercent = BridgeRxBuffer[1];
|
uint8_t brightnessPercent = BridgeRxBuffer[1];
|
||||||
LedPwm_SetBrightness(brightnessPercent);
|
LedPwm_SetBrightness(brightnessPercent);
|
||||||
break;
|
break;
|
||||||
|
case BridgeCommand_SetDisableKeyMatrixScanState:
|
||||||
|
BridgeTxSize = 0;
|
||||||
|
DisableKeyMatrixScanState = BridgeRxBuffer[1];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ key_matrix_t keyMatrix = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
volatile bool DisableKeyMatrixScanState;
|
||||||
|
|
||||||
typedef struct BootloaderConfiguration
|
typedef struct BootloaderConfiguration
|
||||||
{
|
{
|
||||||
uint32_t tag; // Magic number to verify bootloader configuration is valid. Must be set to 'kcfg'.
|
uint32_t tag; // Magic number to verify bootloader configuration is valid. Must be set to 'kcfg'.
|
||||||
@@ -86,7 +88,9 @@ int main(void)
|
|||||||
KeyMatrix_Init(&keyMatrix);
|
KeyMatrix_Init(&keyMatrix);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
KeyMatrix_Scan(&keyMatrix);
|
if (!DisableKeyMatrixScanState) {
|
||||||
|
KeyMatrix_Scan(&keyMatrix);
|
||||||
|
}
|
||||||
asm("wfi");
|
asm("wfi");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,5 +13,6 @@
|
|||||||
// Variables:
|
// Variables:
|
||||||
|
|
||||||
extern key_matrix_t keyMatrix;
|
extern key_matrix_t keyMatrix;
|
||||||
|
extern volatile bool DisableKeyMatrixScanState;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "bridge_protocol.h"
|
#include "bridge_protocol.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "peripherals/test_led.h"
|
#include "peripherals/test_led.h"
|
||||||
|
#include "test_states.h"
|
||||||
|
|
||||||
uhk_module_state_t UhkModuleStates[UHK_MODULE_MAX_COUNT];
|
uhk_module_state_t UhkModuleStates[UHK_MODULE_MAX_COUNT];
|
||||||
uhk_module_field_t currentUhkModuleField = UhkModuleField_SendKeystatesRequestCommand;
|
uhk_module_field_t currentUhkModuleField = UhkModuleField_SendKeystatesRequestCommand;
|
||||||
@@ -44,6 +45,12 @@ bool BridgeSlaveUhkModuleHandler(uint8_t uhkModuleId)
|
|||||||
txBuffer[0] = BridgeCommand_SetTestLed;
|
txBuffer[0] = BridgeCommand_SetTestLed;
|
||||||
txBuffer[1] = uhkModuleInternalState->isTestLedOn;
|
txBuffer[1] = uhkModuleInternalState->isTestLedOn;
|
||||||
I2cAsyncWrite(I2C_ADDRESS_LEFT_KEYBOARD_HALF, txBuffer, 2);
|
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;
|
currentUhkModuleField = UhkModuleField_SendKeystatesRequestCommand;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
UhkModuleField_ReceiveKeystates,
|
UhkModuleField_ReceiveKeystates,
|
||||||
UhkModuleField_SendPwmBrightnessCommand,
|
UhkModuleField_SendPwmBrightnessCommand,
|
||||||
UhkModuleField_SendTestLedCommand,
|
UhkModuleField_SendTestLedCommand,
|
||||||
|
UhkModuleField_SendDisableKeyMatrixScanState,
|
||||||
} uhk_module_field_t;
|
} uhk_module_field_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "bus_pal_hardware.h"
|
#include "bus_pal_hardware.h"
|
||||||
#include "bootloader_config.h"
|
#include "bootloader_config.h"
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
#include "test_states.h"
|
||||||
|
|
||||||
key_matrix_t KeyMatrix = {
|
key_matrix_t KeyMatrix = {
|
||||||
.colNum = KEYBOARD_MATRIX_COLS_NUM,
|
.colNum = KEYBOARD_MATRIX_COLS_NUM,
|
||||||
@@ -75,7 +76,10 @@ void UpdateUsbReports()
|
|||||||
ResetActiveUsbMediaKeyboardReport();
|
ResetActiveUsbMediaKeyboardReport();
|
||||||
ResetActiveUsbSystemKeyboardReport();
|
ResetActiveUsbSystemKeyboardReport();
|
||||||
|
|
||||||
KeyMatrix_Scan(&KeyMatrix);
|
if (!TestStates.disableKeyMatrixScan) {
|
||||||
|
KeyMatrix_Scan(&KeyMatrix);
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(CurrentKeyStates[SLOT_ID_RIGHT_KEYBOARD_HALF], KeyMatrix.keyStates, MAX_KEY_COUNT_PER_MODULE);
|
memcpy(CurrentKeyStates[SLOT_ID_RIGHT_KEYBOARD_HALF], KeyMatrix.keyStates, MAX_KEY_COUNT_PER_MODULE);
|
||||||
UpdateActiveUsbReports();
|
UpdateActiveUsbReports();
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
BridgeCommand_GetKeyStates,
|
BridgeCommand_GetKeyStates,
|
||||||
BridgeCommand_SetTestLed,
|
BridgeCommand_SetTestLed,
|
||||||
BridgeCommand_SetLedPwmBrightness,
|
BridgeCommand_SetLedPwmBrightness,
|
||||||
|
BridgeCommand_SetDisableKeyMatrixScanState,
|
||||||
} bridge_command_t;
|
} bridge_command_t;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include "fsl_gpio.h"
|
#include "fsl_gpio.h"
|
||||||
#include "key_matrix.h"
|
#include "key_matrix.h"
|
||||||
#include "test_states.h"
|
|
||||||
|
|
||||||
void KeyMatrix_Init(key_matrix_t *keyMatrix)
|
void KeyMatrix_Init(key_matrix_t *keyMatrix)
|
||||||
{
|
{
|
||||||
@@ -21,10 +20,6 @@ void KeyMatrix_Init(key_matrix_t *keyMatrix)
|
|||||||
|
|
||||||
void KeyMatrix_Scan(key_matrix_t *keyMatrix)
|
void KeyMatrix_Scan(key_matrix_t *keyMatrix)
|
||||||
{
|
{
|
||||||
if (TestStates.disableKeyMatrixScan) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t *keyState = keyMatrix->keyStates;
|
uint8_t *keyState = keyMatrix->keyStates;
|
||||||
|
|
||||||
key_matrix_pin_t *rowEnd = keyMatrix->rows + keyMatrix->rowNum;
|
key_matrix_pin_t *rowEnd = keyMatrix->rows + keyMatrix->rowNum;
|
||||||
|
|||||||
Reference in New Issue
Block a user