Introduce a new way of activating the test mode
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#include "key_action.h"
|
||||
#include "keymap.h"
|
||||
|
||||
bool TestModeActive = false;
|
||||
|
||||
static const key_action_t TestKeymap[1][2][MAX_KEY_COUNT_PER_MODULE] = {
|
||||
// Base layer
|
||||
{
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
#ifndef __TEST_MODE_H__
|
||||
#define __TEST_MODE_H__
|
||||
|
||||
// Includes:
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
// Functions:
|
||||
|
||||
void TestMode_Activate(void);
|
||||
|
||||
// Variables:
|
||||
|
||||
extern bool TestModeActive;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
#include "usb_protocol_handler.h"
|
||||
#include "usb_commands/usb_command_get_variable.h"
|
||||
#include "key_matrix.h"
|
||||
#include "test_mode.h"
|
||||
|
||||
void UsbCommand_GetVariable(void)
|
||||
{
|
||||
usb_variable_id_t variableId = GetUsbRxBufferUint8(1);
|
||||
|
||||
switch (variableId) {
|
||||
case UsbVariable_TestMode:
|
||||
case UsbVariable_TestModeActive:
|
||||
SetUsbTxBufferUint8(1, TestModeActive);
|
||||
break;
|
||||
case UsbVariable_TestUsbStack:
|
||||
break;
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
#include "usb_protocol_handler.h"
|
||||
#include "usb_commands/usb_command_set_variable.h"
|
||||
#include "key_matrix.h"
|
||||
#include "test_mode.h"
|
||||
|
||||
void UsbCommand_SetVariable(void)
|
||||
{
|
||||
usb_variable_id_t variableId = GetUsbRxBufferUint8(1);
|
||||
|
||||
switch (variableId) {
|
||||
case UsbVariable_TestMode:
|
||||
case UsbVariable_TestModeActive:
|
||||
if (GetUsbRxBufferUint8(2)) {
|
||||
TestModeActive = true;
|
||||
TestMode_Activate();
|
||||
}
|
||||
break;
|
||||
case UsbVariable_TestUsbStack:
|
||||
break;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "usb_protocol_handler.h"
|
||||
#include "usb_commands/usb_command_switch_keymap.h"
|
||||
#include "keymap.h"
|
||||
#include "test_mode.h"
|
||||
|
||||
void UsbCommand_SwitchKeymap(void)
|
||||
{
|
||||
@@ -10,8 +9,6 @@ void UsbCommand_SwitchKeymap(void)
|
||||
|
||||
if (keymapLength > KEYMAP_ABBREVIATION_LENGTH) {
|
||||
SetUsbTxBufferUint8(0, UsbStatusCode_SwitchKeymap_InvalidAbbreviationLength);
|
||||
} else if (keymapLength == 1 && keymapAbbrev[0] == 1) {
|
||||
TestMode_Activate();
|
||||
}
|
||||
|
||||
if (!SwitchKeymapByAbbreviation(keymapLength, keymapAbbrev)) {
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
} usb_command_id_t;
|
||||
|
||||
typedef enum {
|
||||
UsbVariable_TestMode,
|
||||
UsbVariable_TestModeActive,
|
||||
UsbVariable_TestUsbStack,
|
||||
UsbVariable_DebounceTimePress,
|
||||
UsbVariable_DebounceTimeRelease
|
||||
|
||||
Reference in New Issue
Block a user