From 1cd69263a57367721ad5f769ab12f0c6fb23637c Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 20 Mar 2024 08:50:29 +0700 Subject: [PATCH] feat: allows to switch layers via hid --- quantum/oryx.c | 9 +++++++-- quantum/oryx.h | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/quantum/oryx.c b/quantum/oryx.c index e9b0e237d714..4dc37b4e06a6 100644 --- a/quantum/oryx.c +++ b/quantum/oryx.c @@ -68,9 +68,14 @@ void raw_hid_receive(uint8_t *data, uint8_t length) { break; // Keeping this for backwards compatibility with older versions of Wally / Keymapp case ORYX_SET_LAYER: + // The first param's byte is on / off + // The second param's byte is the layer number if (rawhid_state.paired == true) { - layer_clear(); - layer_on(param[0]); + if (param[0] == 0) { + layer_off(param[1]); + } else { + layer_on(param[1]); + } } break; diff --git a/quantum/oryx.h b/quantum/oryx.h index 2a035a89fdde..f8164ca6eb40 100644 --- a/quantum/oryx.h +++ b/quantum/oryx.h @@ -21,7 +21,7 @@ Once the host has paired, it can freely use the commands define in the Oryx_Comm # define RAW_EPSIZE 32 #endif -#define ORYX_PROTOCOL_VERSION = 0x02 +#define ORYX_PROTOCOL_VERSION = 0x03 #define ORYX_STOP_BIT -2 enum Oryx_Command_Code { @@ -47,6 +47,7 @@ enum Oryx_Event_Code { ORYX_EVT_KEYDOWN, ORYX_EVT_KEYUP, ORYX_EVT_RGB_CONTROL, + ORYX_EVT_TOGGLE_SMART_LAYER, ORYX_EVT_GET_PROTOCOL_VERSION = 0XFE, ORYX_EVT_ERROR = 0xFF, };