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