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

@@ -5,6 +5,7 @@
#include "i2c.h"
#include "led_pwm.h"
#include "bridge_protocol.h"
#include "main.h"
void SetError(uint8_t error);
void SetGenericError();
@@ -43,5 +44,9 @@ void BridgeProtocolHandler()
uint8_t brightnessPercent = BridgeRxBuffer[1];
LedPwm_SetBrightness(brightnessPercent);
break;
case BridgeCommand_SetDisableKeyMatrixScanState:
BridgeTxSize = 0;
DisableKeyMatrixScanState = BridgeRxBuffer[1];
break;
}
}

View File

@@ -42,6 +42,8 @@ key_matrix_t keyMatrix = {
#endif
};
volatile bool DisableKeyMatrixScanState;
typedef struct BootloaderConfiguration
{
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);
while (1) {
KeyMatrix_Scan(&keyMatrix);
if (!DisableKeyMatrixScanState) {
KeyMatrix_Scan(&keyMatrix);
}
asm("wfi");
}
}

View File

@@ -13,5 +13,6 @@
// Variables:
extern key_matrix_t keyMatrix;
extern volatile bool DisableKeyMatrixScanState;
#endif