summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorFlorian Didron <fdidron@users.noreply.github.com>2023-09-06 20:45:35 +0700
committerGitHub <noreply@github.com>2023-09-06 20:45:35 +0700
commit551d63b98ff95d5920c1477f1cc84475715bc5e6 (patch)
tree719a504b9ca99cbc34421f44bafb20e99a7a4daf /quantum
parentcf87d88fb228d9118480a98c909508adacb64f26 (diff)
feat/voyager (#374)
* feat: tentative fix for keyboard crash during esd testing * feat: adds support for the GD32 voyager * feat: adds voyager's dfu suffix * fix: instability issues over i2c * fix: more robust right side scan * fix: tentative delay after init * Revert "fix: tentative delay after init" This reverts commit b0a6461cf1cef60574eac1647fd14e1fe63a020c. * fix: scan left side in between right scan process * fix: resets matrix + layer state when reconnecting the right side * chore: comments and code cleanup * fix: restore previous control flow * fix: decouple led driver reinit from io expander reinit * feat: reinit led drivers independtly * fix: prevents slamming the led driver over i2c * Revert "fix: prevents slamming the led driver over i2c" This reverts commit 48b8c809ea7a99ad2c3e941b83313787985c95e0. * Revert "feat: reinit led drivers independtly" This reverts commit 6405e6b3673478af1d98244c4df6ab73b95b18e1. * fix: reboot on io expander * fix: wait time after reading the io expander * chore: code cleanup and some refactors. * feat: adds led brightness and status led control over hid * fix: remove stray printf * fix: compilation error on ergodox * fix: gd32 eeprom fix * fix: caps lock crash * fix: soft reset to bootloader key. * chore: move the app address define where it should be * fix: cleanup + debounce default * feat: tentatively set gd32 clock to 98Mhz * feat: realign to latest chibios contrib * chore: points to ZSA's chibios contrib fork --------- Co-authored-by: Florian Didron <0x6664@hey.com>
Diffstat (limited to 'quantum')
-rw-r--r--quantum/action_layer.c8
-rw-r--r--quantum/oryx.c70
-rw-r--r--quantum/oryx.h5
3 files changed, 79 insertions, 4 deletions
diff --git a/quantum/action_layer.c b/quantum/action_layer.c
index 5cc1ac9b34..edb5d777ce 100644
--- a/quantum/action_layer.c
+++ b/quantum/action_layer.c
@@ -59,7 +59,7 @@ static void default_layer_state_set(layer_state_t state) {
* Print out the hex value of the 32-bit default layer state, as well as the value of the highest bit.
*/
void default_layer_debug(void) {
- dprintf("%08lX(%u)", default_layer_state, get_highest_layer(default_layer_state));
+ // dprintf("%08lX(%u)", default_layer_state, get_highest_layer(default_layer_state));
}
/** \brief Default Layer Set
@@ -121,9 +121,9 @@ __attribute__((weak)) layer_state_t layer_state_set_kb(layer_state_t state) {
*/
void layer_state_set(layer_state_t state) {
state = layer_state_set_kb(state);
-#ifdef ORYX_ENABLE
+# ifdef ORYX_ENABLE
layer_state_set_oryx(state);
-#endif
+# endif
dprint("layer_state: ");
layer_debug();
dprint(" to ");
@@ -223,7 +223,7 @@ void layer_xor(layer_state_t state) {
* Print out the hex value of the 32-bit layer state, as well as the value of the highest bit.
*/
void layer_debug(void) {
- dprintf("%08lX(%u)", layer_state, get_highest_layer(layer_state));
+ // dprintf("%08lX(%u)", layer_state, get_highest_layer(layer_state));
}
#endif
diff --git a/quantum/oryx.c b/quantum/oryx.c
index f3172c3e07..ebcf36ab21 100644
--- a/quantum/oryx.c
+++ b/quantum/oryx.c
@@ -1,6 +1,9 @@
#include <string.h>
#include "oryx.h"
#include "eeprom.h"
+#ifdef KEYBOARD_voyager
+# include "voyager.h"
+#endif
rawhid_state_t rawhid_state = {.pairing = false, .paired = false};
@@ -67,6 +70,10 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
rgb_matrix_mode_noeeprom(RGB_MATRIX_CUSTOM_oryx_webhid_effect);
rawhid_state.rgb_control = true;
}
+ uint8_t event[RAW_EPSIZE];
+ event[0] = ORYX_EVT_RGB_CONTROL;
+ event[1] = rawhid_state.rgb_control;
+ raw_hid_send(event, RAW_EPSIZE);
#else
oryx_error(ORYX_ERR_RGB_MATRIX_NOT_ENABLED);
#endif
@@ -79,6 +86,69 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
oryx_error(ORYX_ERR_RGB_MATRIX_NOT_ENABLED);
#endif
break;
+ case ORYX_SET_STATUS_LED:
+ switch (param[0]) {
+ case 0:
+#ifdef STATUS_LED_1
+ STATUS_LED_1(param[1]);
+#else
+ oryx_error(ORYX_ERR_STATUS_LED_OUT_OF_RANGE);
+#endif
+ break;
+ case 1:
+#ifdef STATUS_LED_2
+ STATUS_LED_2(param[1]);
+#else
+ oryx_error(ORYX_ERR_STATUS_LED_OUT_OF_RANGE);
+#endif
+ break;
+ case 2:
+#ifdef STATUS_LED_3
+ STATUS_LED_3(param[1]);
+#else
+ oryx_error(ORYX_ERR_STATUS_LED_OUT_OF_RANGE);
+#endif
+ break;
+ case 3:
+#ifdef STATUS_LED_4
+ STATUS_LED_4(param[1]);
+#else
+ oryx_error(ORYX_ERR_STATUS_LED_OUT_OF_RANGE);
+#endif
+ break;
+ case 4:
+#ifdef STATUS_LED_5
+ STATUS_LED_5(param[1]);
+#else
+ oryx_error(ORYX_ERR_STATUS_LED_OUT_OF_RANGE);
+#endif
+ break;
+ case 5:
+#ifdef STATUS_LED_6
+ STATUS_LED_6(param[1]);
+#else
+ oryx_error(ORYX_ERR_STATUS_LED_OUT_OF_RANGE);
+#endif
+ break;
+
+ default:
+ oryx_error(ORYX_ERR_STATUS_LED_OUT_OF_RANGE);
+ break;
+ }
+ break;
+ case ORYX_UPDATE_BRIGHTNESS:
+#if defined(RGB_MATRIX_ENABLE) && !defined(KEYBOARD_ergodox_ez_glow)
+ if (param[0]) {
+ rgb_matrix_increase_val_noeeprom();
+ } else {
+ rgb_matrix_decrease_val_noeeprom();
+ }
+#else
+ oryx_error(ORYX_ERR_RGB_MATRIX_NOT_ENABLED);
+#endif
+ break;
+ default:
+ oryx_error(ORYX_ERR_UNKNOWN_COMMAND);
}
}
diff --git a/quantum/oryx.h b/quantum/oryx.h
index 25deb74f55..063353468e 100644
--- a/quantum/oryx.h
+++ b/quantum/oryx.h
@@ -37,6 +37,8 @@ enum Oryx_Command_Code {
ORYX_SET_LAYER,
ORYX_RGB_CONTROL,
ORYX_SET_RGB_LED,
+ ORYX_SET_STATUS_LED,
+ ORYX_UPDATE_BRIGHTNESS,
ORYX_GET_PROTOCOL_VERSION = 0xFE,
};
@@ -49,6 +51,7 @@ enum Oryx_Event_Code {
ORYX_EVT_LAYER,
ORYX_EVT_KEYDOWN,
ORYX_EVT_KEYUP,
+ ORYX_EVT_RGB_CONTROL,
ORYX_EVT_GET_PROTOCOL_VERSION = 0XFE,
ORYX_EVT_ERROR = 0xFF,
};
@@ -59,6 +62,8 @@ enum Oryx_Error_Code {
ORYX_ERR_PAIRING_KEY_INPUT_FAILED,
ORYX_ERR_PAIRING_FAILED,
ORYX_ERR_RGB_MATRIX_NOT_ENABLED,
+ ORYX_ERR_STATUS_LED_OUT_OF_RANGE,
+ ORYX_ERR_UNKNOWN_COMMAND = 0xFF,
};
extern bool oryx_state_live_training_enabled;