From e0868ac8668d6581170598d2eb4290b32c4a379d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Fri, 3 Nov 2017 02:46:34 +0100 Subject: [PATCH] Rename CurrentKeyStates to KeyStates and move it to the newly created key_states.[ch] --- right/src/key_states.c | 3 +++ right/src/key_states.h | 14 ++++++++++++++ right/src/main.c | 5 ++--- right/src/main.h | 2 -- right/src/slave_drivers/uhk_module_driver.c | 3 ++- right/src/usb_report_updater.c | 5 +++-- 6 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 right/src/key_states.c create mode 100644 right/src/key_states.h diff --git a/right/src/key_states.c b/right/src/key_states.c new file mode 100644 index 0000000..38d8cf2 --- /dev/null +++ b/right/src/key_states.c @@ -0,0 +1,3 @@ +#include "key_states.h" + +uint8_t KeyStates[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE]; diff --git a/right/src/key_states.h b/right/src/key_states.h new file mode 100644 index 0000000..669ff0c --- /dev/null +++ b/right/src/key_states.h @@ -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 diff --git a/right/src/main.c b/right/src/main.c index f5db893..b39cc31 100644 --- a/right/src/main.c +++ b/right/src/main.c @@ -16,8 +16,7 @@ #include "eeprom.h" #include "key_matrix_instance.h" #include "key_scanner.h" - -uint8_t CurrentKeyStates[SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE]; +#include "key_states.h" void UpdateUsbReports(void) { @@ -29,7 +28,7 @@ void UpdateUsbReports(void) KeyMatrix_Scan(&KeyMatrix); #endif - memcpy(CurrentKeyStates[SlotId_RightKeyboardHalf], KeyMatrix.keyStates, MAX_KEY_COUNT_PER_MODULE); + memcpy(KeyStates[SlotId_RightKeyboardHalf], KeyMatrix.keyStates, MAX_KEY_COUNT_PER_MODULE); ResetActiveUsbBasicKeyboardReport(); ResetActiveUsbMediaKeyboardReport(); diff --git a/right/src/main.h b/right/src/main.h index 0f4b2fd..7aa3bc3 100644 --- a/right/src/main.h +++ b/right/src/main.h @@ -9,8 +9,6 @@ // 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); #endif diff --git a/right/src/slave_drivers/uhk_module_driver.c b/right/src/slave_drivers/uhk_module_driver.c index 731f9e4..40c7ed4 100644 --- a/right/src/slave_drivers/uhk_module_driver.c +++ b/right/src/slave_drivers/uhk_module_driver.c @@ -7,6 +7,7 @@ #include "peripherals/test_led.h" #include "bool_array_converter.h" #include "crc16.h" +#include "key_states.h" uhk_module_state_t UhkModuleStates[UHK_MODULE_MAX_COUNT]; @@ -171,7 +172,7 @@ status_t UhkModuleSlaveDriver_Update(uint8_t uhkModuleDriverId) case UhkModulePhase_ProcessKeystates: if (CRC16_IsMessageValid(rxMessage)) { 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; *uhkModulePhase = UhkModulePhase_JumpToBootloader; diff --git a/right/src/usb_report_updater.c b/right/src/usb_report_updater.c index 6669fbf..25f5ea9 100644 --- a/right/src/usb_report_updater.c +++ b/right/src/usb_report_updater.c @@ -9,6 +9,7 @@ #include "slave_drivers/uhk_module_driver.h" #include "led_pwm.h" #include "macros.h" +#include "key_states.h" static uint8_t mouseWheelDivisorCounter = 0; static uint8_t mouseSpeedAccelDivisorCounter = 0; @@ -77,7 +78,7 @@ uint8_t getActiveLayer(void) uint8_t activeLayer = LayerId_Base; for (uint8_t slotId=0; slotId