Rename CurrentKeyStates to KeyStates and move it to the newly created key_states.[ch]
This commit is contained in:
3
right/src/key_states.c
Normal file
3
right/src/key_states.c
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#include "key_states.h"
|
||||||
|
|
||||||
|
uint8_t KeyStates[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
|
||||||
14
right/src/key_states.h
Normal file
14
right/src/key_states.h
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#ifndef __KEY_STATES_H__
|
||||||
|
#define __KEY_STATES_H__
|
||||||
|
|
||||||
|
// Includes:
|
||||||
|
|
||||||
|
#include "fsl_common.h"
|
||||||
|
#include "slot.h"
|
||||||
|
#include "module.h"
|
||||||
|
|
||||||
|
// Variables:
|
||||||
|
|
||||||
|
extern uint8_t KeyStates[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -16,8 +16,7 @@
|
|||||||
#include "eeprom.h"
|
#include "eeprom.h"
|
||||||
#include "key_matrix_instance.h"
|
#include "key_matrix_instance.h"
|
||||||
#include "key_scanner.h"
|
#include "key_scanner.h"
|
||||||
|
#include "key_states.h"
|
||||||
uint8_t CurrentKeyStates[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
|
|
||||||
|
|
||||||
void UpdateUsbReports(void)
|
void UpdateUsbReports(void)
|
||||||
{
|
{
|
||||||
@@ -29,7 +28,7 @@ void UpdateUsbReports(void)
|
|||||||
KeyMatrix_Scan(&KeyMatrix);
|
KeyMatrix_Scan(&KeyMatrix);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memcpy(CurrentKeyStates[SlotId_RightKeyboardHalf], KeyMatrix.keyStates, MAX_KEY_COUNT_PER_MODULE);
|
memcpy(KeyStates[SlotId_RightKeyboardHalf], KeyMatrix.keyStates, MAX_KEY_COUNT_PER_MODULE);
|
||||||
|
|
||||||
ResetActiveUsbBasicKeyboardReport();
|
ResetActiveUsbBasicKeyboardReport();
|
||||||
ResetActiveUsbMediaKeyboardReport();
|
ResetActiveUsbMediaKeyboardReport();
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
// Variables:
|
// Variables:
|
||||||
|
|
||||||
extern uint8_t PreviousKeyStates[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
|
|
||||||
extern uint8_t CurrentKeyStates[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE];
|
|
||||||
extern void UpdateUsbReports(void);
|
extern void UpdateUsbReports(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "peripherals/test_led.h"
|
#include "peripherals/test_led.h"
|
||||||
#include "bool_array_converter.h"
|
#include "bool_array_converter.h"
|
||||||
#include "crc16.h"
|
#include "crc16.h"
|
||||||
|
#include "key_states.h"
|
||||||
|
|
||||||
uhk_module_state_t UhkModuleStates[UHK_MODULE_MAX_COUNT];
|
uhk_module_state_t UhkModuleStates[UHK_MODULE_MAX_COUNT];
|
||||||
|
|
||||||
@@ -171,7 +172,7 @@ status_t UhkModuleSlaveDriver_Update(uint8_t uhkModuleDriverId)
|
|||||||
case UhkModulePhase_ProcessKeystates:
|
case UhkModulePhase_ProcessKeystates:
|
||||||
if (CRC16_IsMessageValid(rxMessage)) {
|
if (CRC16_IsMessageValid(rxMessage)) {
|
||||||
uint8_t slotId = uhkModuleDriverId + 1;
|
uint8_t slotId = uhkModuleDriverId + 1;
|
||||||
BoolBitsToBytes(rxMessage->data, CurrentKeyStates[slotId], uhkModuleState->features.keyCount);
|
BoolBitsToBytes(rxMessage->data, KeyStates[slotId], uhkModuleState->features.keyCount);
|
||||||
}
|
}
|
||||||
status = kStatus_Uhk_NoTransfer;
|
status = kStatus_Uhk_NoTransfer;
|
||||||
*uhkModulePhase = UhkModulePhase_JumpToBootloader;
|
*uhkModulePhase = UhkModulePhase_JumpToBootloader;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "slave_drivers/uhk_module_driver.h"
|
#include "slave_drivers/uhk_module_driver.h"
|
||||||
#include "led_pwm.h"
|
#include "led_pwm.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
#include "key_states.h"
|
||||||
|
|
||||||
static uint8_t mouseWheelDivisorCounter = 0;
|
static uint8_t mouseWheelDivisorCounter = 0;
|
||||||
static uint8_t mouseSpeedAccelDivisorCounter = 0;
|
static uint8_t mouseSpeedAccelDivisorCounter = 0;
|
||||||
@@ -77,7 +78,7 @@ uint8_t getActiveLayer(void)
|
|||||||
uint8_t activeLayer = LayerId_Base;
|
uint8_t activeLayer = LayerId_Base;
|
||||||
for (uint8_t slotId=0; slotId<SLOT_COUNT; slotId++) {
|
for (uint8_t slotId=0; slotId<SLOT_COUNT; slotId++) {
|
||||||
for (uint8_t keyId=0; keyId<MAX_KEY_COUNT_PER_MODULE; keyId++) {
|
for (uint8_t keyId=0; keyId<MAX_KEY_COUNT_PER_MODULE; keyId++) {
|
||||||
if (CurrentKeyStates[slotId][keyId]) {
|
if (KeyStates[slotId][keyId]) {
|
||||||
key_action_t action = CurrentKeymap[LayerId_Base][slotId][keyId];
|
key_action_t action = CurrentKeymap[LayerId_Base][slotId][keyId];
|
||||||
if (action.type == KeyActionType_SwitchLayer) {
|
if (action.type == KeyActionType_SwitchLayer) {
|
||||||
activeLayer = action.switchLayer.layer;
|
activeLayer = action.switchLayer.layer;
|
||||||
@@ -110,7 +111,7 @@ void UpdateActiveUsbReports(void)
|
|||||||
for (uint8_t slotId=0; slotId<SLOT_COUNT; slotId++) {
|
for (uint8_t slotId=0; slotId<SLOT_COUNT; slotId++) {
|
||||||
for (uint8_t keyId=0; keyId<MAX_KEY_COUNT_PER_MODULE; keyId++) {
|
for (uint8_t keyId=0; keyId<MAX_KEY_COUNT_PER_MODULE; keyId++) {
|
||||||
|
|
||||||
if (!CurrentKeyStates[slotId][keyId]) {
|
if (!KeyStates[slotId][keyId]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user