summaryrefslogtreecommitdiff
path: root/quantum/oryx.c
diff options
context:
space:
mode:
authorDrashna Jael're <drashna@live.com>2020-01-14 17:48:23 -0800
committerFlorian Didron <fdidron@users.noreply.github.com>2020-02-26 10:15:12 +0900
commit5ed3ecdd73913ee484777ab33840f3ece5d3571f (patch)
treefefde0dbeadfa6cbf379e63784fdc5b48c769431 /quantum/oryx.c
parent259cc072029c3358827c7ef6c2462a3d4a6a1f52 (diff)
Add toggle for live training
Diffstat (limited to 'quantum/oryx.c')
-rw-r--r--quantum/oryx.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/quantum/oryx.c b/quantum/oryx.c
index 93ee50e935..7f0b60a797 100644
--- a/quantum/oryx.c
+++ b/quantum/oryx.c
@@ -1,18 +1,41 @@
#include "oryx.h"
-bool webusb_state_live_training_enabled;
+bool oryx_state_live_training_enabled;
bool webusb_receive_oryx(uint8_t *data, uint8_t length) {
uint8_t command = data[0];
+ uint8_t param = data[1];
switch (command) {
case ORYX_GET_LAYER:
oryx_layer_event();
return true; break;
+ case ORYX_CMD_LIVE_TRAINING: {
+ uint8_t event[4];
+ switch (param) { // 0 for state, 1 for off, 2 for on
+ case 0:
+ break;
+ case 1:
+ oryx_state_live_training_enabled = false;
+ break;
+ case 2:
+ oryx_state_live_training_enabled = true;
+ break;
+ default:
+ webusb_error(WEBUSB_STATUS_UNKNOWN_COMMAND);
+ return true;
+ }
+ event[0] = WEBUSB_STATUS_OK;
+ event[1] = WEBUSB_EVT_PAIRED;
+ event[2] = oryx_state_live_training_enabled;
+ event[3] = WEBUSB_STOP_BIT;
+ webusb_send(event, sizeof(event));
+ return true;
+ }
+ default:
+ return webusb_receive_kb(data, length);
}
-
- return false;
}
@@ -28,3 +51,7 @@ void oryx_layer_event(void) {
webusb_send(event, sizeof(event));
#endif
}
+
+bool is_oryx_live_training_enabled(void) {
+ return oryx_state_live_training_enabled;
+}