Remove test actions and related code.
This commit is contained in:
@@ -61,15 +61,6 @@
|
|||||||
MouseScroll_Right = 1 << 3,
|
MouseScroll_Right = 1 << 3,
|
||||||
} mouse_scroll_t;
|
} mouse_scroll_t;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
TestAction_DisableUsb,
|
|
||||||
TestAction_DisableI2c,
|
|
||||||
TestAction_DisableKeyMatrixScan,
|
|
||||||
TestAction_DisableLedSdb,
|
|
||||||
TestAction_DisableLedFetPwm,
|
|
||||||
TestAction_DisableLedDriverPwm,
|
|
||||||
} test_action_t;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
union {
|
union {
|
||||||
@@ -94,9 +85,6 @@
|
|||||||
struct {
|
struct {
|
||||||
uint8_t macroId;
|
uint8_t macroId;
|
||||||
} __attribute__ ((packed)) playMacro;
|
} __attribute__ ((packed)) playMacro;
|
||||||
struct {
|
|
||||||
test_action_t testAction;
|
|
||||||
} __attribute__ ((packed)) test;
|
|
||||||
};
|
};
|
||||||
} __attribute__ ((packed)) key_action_t;
|
} __attribute__ ((packed)) key_action_t;
|
||||||
|
|
||||||
|
|||||||
@@ -225,29 +225,23 @@ key_action_t CurrentKeymap[LAYER_COUNT][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE] =
|
|||||||
// Right keyboard half
|
// Right keyboard half
|
||||||
{
|
{
|
||||||
// Row 1
|
// Row 1
|
||||||
// { .type = KEY_ACTION_NONE },
|
{ .type = KeyActionType_None },
|
||||||
// { .type = KEY_ACTION_NONE },
|
{ .type = KeyActionType_None },
|
||||||
// { .type = KEY_ACTION_NONE },
|
{ .type = KeyActionType_None },
|
||||||
{ .type = KeyActionType_Test, .test = { .testAction = TestAction_DisableUsb }},
|
|
||||||
{ .type = KeyActionType_Test, .test = { .testAction = TestAction_DisableI2c }},
|
|
||||||
{ .type = KeyActionType_Test, .test = { .testAction = TestAction_DisableKeyMatrixScan }},
|
|
||||||
{ .type = KeyActionType_None },
|
{ .type = KeyActionType_None },
|
||||||
{ .type = KeyActionType_None },
|
{ .type = KeyActionType_None },
|
||||||
{ .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_System, .scancode = SYSTEM_WAKE_UP }},
|
{ .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_System, .scancode = SYSTEM_WAKE_UP }},
|
||||||
{ .type = KeyActionType_None },
|
{ .type = KeyActionType_None },
|
||||||
|
|
||||||
// Row 2
|
// Row 2
|
||||||
// { .type = KEY_ACTION_KEYSTROKE, .keystroke = { .keystrokeType = KEYSTROKE_MEDIA, .scancode = MEDIA_PLAY_PAUSE }},
|
{ .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = MEDIA_PLAY_PAUSE }},
|
||||||
// { .type = KEY_ACTION_KEYSTROKE, .keystroke = { .keystrokeType = KEYSTROKE_MEDIA, .scancode = MEDIA_VOLUME_UP }},
|
{ .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = MEDIA_VOLUME_UP }},
|
||||||
{ .type = KeyActionType_Test, .test = { .testAction = TestAction_DisableLedSdb }},
|
|
||||||
{ .type = KeyActionType_Test, .test = { .testAction = TestAction_DisableLedFetPwm }},
|
|
||||||
{ .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = MEDIA_STOP }},
|
{ .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = MEDIA_STOP }},
|
||||||
{ .type = KeyActionType_None },
|
{ .type = KeyActionType_None },
|
||||||
{ .type = KeyActionType_None },
|
{ .type = KeyActionType_None },
|
||||||
{ .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_System, .scancode = SYSTEM_SLEEP }},
|
{ .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_System, .scancode = SYSTEM_SLEEP }},
|
||||||
{ .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_System, .scancode = SYSTEM_POWER_DOWN }},
|
{ .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_System, .scancode = SYSTEM_POWER_DOWN }},
|
||||||
// { .type = KEY_ACTION_NONE },
|
{ .type = KeyActionType_None },
|
||||||
{ .type = KeyActionType_Test, .test = { .testAction = TestAction_DisableLedDriverPwm }},
|
|
||||||
|
|
||||||
// Row 3
|
// Row 3
|
||||||
{ .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = MEDIA_PREVIOUS }},
|
{ .type = KeyActionType_Keystroke, .keystroke = { .keystrokeType = KeystrokeType_Media, .scancode = MEDIA_PREVIOUS }},
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
#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"
|
|
||||||
#include "wormhole.h"
|
#include "wormhole.h"
|
||||||
|
|
||||||
key_matrix_t KeyMatrix = {
|
key_matrix_t KeyMatrix = {
|
||||||
@@ -48,9 +47,7 @@ void UpdateUsbReports()
|
|||||||
ResetActiveUsbMediaKeyboardReport();
|
ResetActiveUsbMediaKeyboardReport();
|
||||||
ResetActiveUsbSystemKeyboardReport();
|
ResetActiveUsbSystemKeyboardReport();
|
||||||
|
|
||||||
if (!TestStates.disableKeyMatrixScan) {
|
KeyMatrix_Scan(&KeyMatrix);
|
||||||
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();
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "slave_protocol.h"
|
#include "slave_protocol.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "peripherals/test_led.h"
|
#include "peripherals/test_led.h"
|
||||||
#include "test_states.h"
|
|
||||||
#include "bool_array_converter.h"
|
#include "bool_array_converter.h"
|
||||||
#include "crc16.h"
|
#include "crc16.h"
|
||||||
|
|
||||||
@@ -47,24 +46,6 @@ void UhkModuleSlaveDriver_Update(uint8_t uhkModuleId)
|
|||||||
txBuffer[0] = SlaveCommand_SetTestLed;
|
txBuffer[0] = SlaveCommand_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);
|
||||||
uhkModulePhase = UhkModulePhase_SendDisableKeyMatrixScanState;
|
|
||||||
break;
|
|
||||||
case UhkModulePhase_SendDisableKeyMatrixScanState:
|
|
||||||
txBuffer[0] = SlaveCommand_SetDisableKeyMatrixScanState;
|
|
||||||
txBuffer[1] = TestStates.disableKeyMatrixScan;
|
|
||||||
I2cAsyncWrite(I2C_ADDRESS_LEFT_KEYBOARD_HALF, txBuffer, 2);
|
|
||||||
uhkModulePhase = UhkModulePhase_SendLedPwmBrightness;
|
|
||||||
break;
|
|
||||||
case UhkModulePhase_SendLedPwmBrightness:
|
|
||||||
txBuffer[0] = SlaveCommand_SetDisableKeyMatrixScanState;
|
|
||||||
txBuffer[1] = TestStates.disableKeyMatrixScan;
|
|
||||||
I2cAsyncWrite(I2C_ADDRESS_LEFT_KEYBOARD_HALF, txBuffer, 2);
|
|
||||||
uhkModulePhase = UhkModulePhase_DisableLedSdb;
|
|
||||||
break;
|
|
||||||
case UhkModulePhase_DisableLedSdb:
|
|
||||||
txBuffer[0] = SlaveCommand_SetDisableLedSdb;
|
|
||||||
txBuffer[1] = TestStates.disableLedSdb;
|
|
||||||
I2cAsyncWrite(I2C_ADDRESS_LEFT_KEYBOARD_HALF, txBuffer, 2);
|
|
||||||
uhkModulePhase = UhkModulePhase_SendKeystatesRequestCommand;
|
uhkModulePhase = UhkModulePhase_SendKeystatesRequestCommand;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,6 @@
|
|||||||
UhkModulePhase_ReceiveKeystates,
|
UhkModulePhase_ReceiveKeystates,
|
||||||
UhkModulePhase_SendPwmBrightnessCommand,
|
UhkModulePhase_SendPwmBrightnessCommand,
|
||||||
UhkModulePhase_SendTestLedCommand,
|
UhkModulePhase_SendTestLedCommand,
|
||||||
UhkModulePhase_SendDisableKeyMatrixScanState,
|
|
||||||
UhkModulePhase_SendLedPwmBrightness,
|
|
||||||
UhkModulePhase_DisableLedSdb,
|
|
||||||
} uhk_module_phase_t;
|
} uhk_module_phase_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "slave_drivers/uhk_module_driver.h"
|
#include "slave_drivers/uhk_module_driver.h"
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
#include "i2c_addresses.h"
|
#include "i2c_addresses.h"
|
||||||
#include "test_states.h"
|
|
||||||
|
|
||||||
uint8_t previousSlaveId = 0;
|
uint8_t previousSlaveId = 0;
|
||||||
uint8_t currentSlaveId = 0;
|
uint8_t currentSlaveId = 0;
|
||||||
@@ -24,9 +23,6 @@ static void bridgeProtocolCallback(I2C_Type *base, i2c_master_handle_t *handle,
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
BridgeCounter++;
|
BridgeCounter++;
|
||||||
if (TestStates.disableI2c) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uhk_slave_t *previousSlave = Slaves + previousSlaveId;
|
uhk_slave_t *previousSlave = Slaves + previousSlaveId;
|
||||||
uhk_slave_t *currentSlave = Slaves + currentSlaveId;
|
uhk_slave_t *currentSlave = Slaves + currentSlaveId;
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
#ifndef __TEST_STATES_H__
|
|
||||||
#define __TEST_STATES_H__
|
|
||||||
|
|
||||||
// Typedefs:
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
bool disableUsb;
|
|
||||||
bool disableI2c;
|
|
||||||
bool disableKeyMatrixScan;
|
|
||||||
bool disableLedSdb;
|
|
||||||
bool disableLedFetPwm;
|
|
||||||
bool disableLedDriverPwm;
|
|
||||||
} test_states_t;
|
|
||||||
|
|
||||||
// Variables:
|
|
||||||
|
|
||||||
extern test_states_t TestStates;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "layer.h"
|
#include "layer.h"
|
||||||
#include "usb_interfaces/usb_interface_mouse.h"
|
#include "usb_interfaces/usb_interface_mouse.h"
|
||||||
#include "keymaps.h"
|
#include "keymaps.h"
|
||||||
#include "test_states.h"
|
|
||||||
#include "peripherals/test_led.h"
|
#include "peripherals/test_led.h"
|
||||||
#include "slave_drivers/is31fl3731_driver.h"
|
#include "slave_drivers/is31fl3731_driver.h"
|
||||||
#include "slave_drivers/uhk_module_driver.h"
|
#include "slave_drivers/uhk_module_driver.h"
|
||||||
@@ -15,7 +14,6 @@ static uint8_t mouseWheelDivisorCounter = 0;
|
|||||||
static uint8_t mouseSpeedAccelDivisorCounter = 0;
|
static uint8_t mouseSpeedAccelDivisorCounter = 0;
|
||||||
static uint8_t mouseSpeed = 3;
|
static uint8_t mouseSpeed = 3;
|
||||||
static bool wasPreviousMouseActionWheelAction = false;
|
static bool wasPreviousMouseActionWheelAction = false;
|
||||||
test_states_t TestStates;
|
|
||||||
|
|
||||||
void processMouseAction(key_action_t action)
|
void processMouseAction(key_action_t action)
|
||||||
{
|
{
|
||||||
@@ -74,40 +72,6 @@ void processMouseAction(key_action_t action)
|
|||||||
wasPreviousMouseActionWheelAction = isWheelAction;
|
wasPreviousMouseActionWheelAction = isWheelAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
void processTestAction(key_action_t testAction)
|
|
||||||
{
|
|
||||||
switch (testAction.test.testAction) {
|
|
||||||
case TestAction_DisableUsb:
|
|
||||||
if (kStatus_USB_Success != USB_DeviceClassDeinit(CONTROLLER_ID)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Make sure we are clocking to the peripheral to ensure there are no bus errors
|
|
||||||
if (SIM->SCGC4 & SIM_SCGC4_USBOTG_MASK) {
|
|
||||||
NVIC_DisableIRQ(USB0_IRQn); // Disable the USB interrupt
|
|
||||||
NVIC_ClearPendingIRQ(USB0_IRQn); // Clear any pending interrupts on USB
|
|
||||||
SIM->SCGC4 &= ~SIM_SCGC4_USBOTG_MASK; // Turn off clocking to USB
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TestAction_DisableI2c:
|
|
||||||
TestStates.disableI2c = true;
|
|
||||||
break;
|
|
||||||
case TestAction_DisableKeyMatrixScan:
|
|
||||||
TestStates.disableKeyMatrixScan = true;
|
|
||||||
break;
|
|
||||||
case TestAction_DisableLedDriverPwm:
|
|
||||||
SetLeds(0);
|
|
||||||
break;
|
|
||||||
case TestAction_DisableLedFetPwm:
|
|
||||||
LedPwm_SetBrightness(0);
|
|
||||||
UhkModuleStates[0].ledPwmBrightness = 0;
|
|
||||||
break;
|
|
||||||
case TestAction_DisableLedSdb:
|
|
||||||
GPIO_WritePinOutput(LED_DRIVER_SDB_GPIO, LED_DRIVER_SDB_PIN, 0);
|
|
||||||
TestStates.disableLedSdb = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t getActiveLayer()
|
uint8_t getActiveLayer()
|
||||||
{
|
{
|
||||||
uint8_t activeLayer = LAYER_ID_BASE;
|
uint8_t activeLayer = LAYER_ID_BASE;
|
||||||
@@ -181,9 +145,6 @@ void UpdateActiveUsbReports()
|
|||||||
case KeyActionType_Mouse:
|
case KeyActionType_Mouse:
|
||||||
processMouseAction(action);
|
processMouseAction(action);
|
||||||
break;
|
break;
|
||||||
case KeyActionType_Test:
|
|
||||||
processTestAction(action);
|
|
||||||
break;
|
|
||||||
case KeyActionType_SwitchKeymap:
|
case KeyActionType_SwitchKeymap:
|
||||||
Keymaps_Switch(action.switchKeymap.keymapId);
|
Keymaps_Switch(action.switchKeymap.keymapId);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -7,8 +7,6 @@
|
|||||||
SlaveCommand_GetKeyStates,
|
SlaveCommand_GetKeyStates,
|
||||||
SlaveCommand_SetTestLed,
|
SlaveCommand_SetTestLed,
|
||||||
SlaveCommand_SetLedPwmBrightness,
|
SlaveCommand_SetLedPwmBrightness,
|
||||||
SlaveCommand_SetDisableKeyMatrixScanState,
|
|
||||||
SlaveCommand_SetDisableLedSdb,
|
|
||||||
} slave_command_t;
|
} slave_command_t;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user