Rename CurrentKeyStates to KeyStates and move it to the newly created key_states.[ch]

This commit is contained in:
László Monda
2017-11-03 02:46:34 +01:00
parent a7e70d0cb2
commit e0868ac866
6 changed files with 24 additions and 8 deletions

3
right/src/key_states.c Normal file
View 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
View 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

View File

@@ -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();

View File

@@ -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

View File

@@ -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;

View File

@@ -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<SLOT_COUNT; slotId++) {
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];
if (action.type == KeyActionType_SwitchLayer) {
activeLayer = action.switchLayer.layer;
@@ -110,7 +111,7 @@ void UpdateActiveUsbReports(void)
for (uint8_t slotId=0; slotId<SLOT_COUNT; slotId++) {
for (uint8_t keyId=0; keyId<MAX_KEY_COUNT_PER_MODULE; keyId++) {
if (!CurrentKeyStates[slotId][keyId]) {
if (!KeyStates[slotId][keyId]) {
continue;
}