Implement core communication
This commit is contained in:
committed by
Florian Didron
parent
5c1c41462a
commit
3b71e1e819
@@ -191,3 +191,40 @@ void oryx_layer_event(void) {
|
||||
}
|
||||
|
||||
bool is_oryx_live_training_enabled(void) { return oryx_state_live_training_enabled; }
|
||||
|
||||
bool process_record_oryx(uint16_t keycode, keyrecord_t *record) {
|
||||
if(is_oryx_live_training_enabled()) {
|
||||
uint8_t event[5];
|
||||
event[0] = WEBUSB_STATUS_OK;
|
||||
event[1] = record->event.pressed ? ORYX_EVT_KEYDOWN : ORYX_EVT_KEYUP;
|
||||
event[2] = record->event.key.col;
|
||||
event[3] = record->event.key.row;
|
||||
event[4] = WEBUSB_STOP_BIT;
|
||||
webusb_send(event, sizeof(event));
|
||||
}
|
||||
|
||||
switch (keycode) {
|
||||
case WEBUSB_PAIR:
|
||||
if (record->event.pressed) {
|
||||
webusb_state.pairing = true;
|
||||
}
|
||||
return false;
|
||||
case MACRO00 ... MACRO15:
|
||||
if (record->event.pressed) {
|
||||
dynamic_keymap_macro_send(keycode - MACRO00);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void layer_state_set_oryx(layer_state_t state) {
|
||||
if(is_oryx_live_training_enabled()) {
|
||||
uint8_t event[4];
|
||||
event[0] = WEBUSB_STATUS_OK;
|
||||
event[1] = ORYX_EVT_LAYER;
|
||||
event[2] = get_highest_layer(state);
|
||||
event[3] = WEBUSB_STOP_BIT;
|
||||
webusb_send(event, sizeof(event));
|
||||
}
|
||||
}
|
||||
|
||||
+20
-1
@@ -54,6 +54,24 @@ enum Oryx_Event_Code {
|
||||
ORYX_EVT_KEYUP,
|
||||
};
|
||||
|
||||
enum dynamic_macros_keycodes {
|
||||
MACRO00 = 0x5F12,
|
||||
MACRO01,
|
||||
MACRO02,
|
||||
MACRO03,
|
||||
MACRO04,
|
||||
MACRO05,
|
||||
MACRO06,
|
||||
MACRO07,
|
||||
MACRO08,
|
||||
MACRO09,
|
||||
MACRO10,
|
||||
MACRO11,
|
||||
MACRO12,
|
||||
MACRO13,
|
||||
MACRO14,
|
||||
MACRO15,
|
||||
};
|
||||
|
||||
|
||||
extern bool oryx_state_live_training_enabled;
|
||||
@@ -61,5 +79,6 @@ extern bool oryx_state_live_training_enabled;
|
||||
bool webusb_receive_oryx(uint8_t *data, uint8_t length);
|
||||
void oryx_layer_event(void);
|
||||
bool is_oryx_live_training_enabled(void);
|
||||
|
||||
bool process_record_oryx(uint16_t keycode, keyrecord_t *record);
|
||||
void layer_state_set_oryx(layer_state_t state);
|
||||
void keyboard_pre_init_oryx(void);
|
||||
|
||||
+3
-5
@@ -210,6 +210,9 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
#if defined(RGB_MATRIX_ENABLE)
|
||||
process_rgb_matrix(keycode, record) &&
|
||||
#endif
|
||||
#ifdef ORYX_ENABLE
|
||||
process_record_oryx(keycode, record) &&
|
||||
#endif
|
||||
#if defined(VIA_ENABLE)
|
||||
process_record_via(keycode, record) &&
|
||||
#endif
|
||||
@@ -309,11 +312,6 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
case BL_BRTG:
|
||||
backlight_toggle_breathing();
|
||||
return false;
|
||||
#endif
|
||||
#ifdef WEBUSB_ENABLE
|
||||
case WEBUSB_PAIR:
|
||||
webusb_state.pairing = true;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user