mirror of
https://github.com/zsa/qmk_firmware.git
synced 2026-01-09 15:12:33 +00:00
fix: restores status led control voyager / moonlander
This commit is contained in:
@@ -2,11 +2,13 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include QMK_KEYBOARD_H
|
||||||
#include "oryx.h"
|
#include "oryx.h"
|
||||||
|
|
||||||
rawhid_state_t rawhid_state = {
|
rawhid_state_t rawhid_state = {
|
||||||
.paired = false,
|
.paired = false,
|
||||||
.rgb_control = false,
|
.rgb_control = false,
|
||||||
|
.status_led_control = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
uint8_t pairing_input_index = 0;
|
uint8_t pairing_input_index = 0;
|
||||||
@@ -250,6 +252,26 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
|
|||||||
}
|
}
|
||||||
case ORYX_STATUS_LED_CONTROL: {
|
case ORYX_STATUS_LED_CONTROL: {
|
||||||
rawhid_state.status_led_control = param[0];
|
rawhid_state.status_led_control = param[0];
|
||||||
|
if (!param[0]) {
|
||||||
|
#ifdef STATUS_LED_1
|
||||||
|
STATUS_LED_1(0);
|
||||||
|
#endif
|
||||||
|
#ifdef STATUS_LED_2
|
||||||
|
STATUS_LED_2(0);
|
||||||
|
#endif
|
||||||
|
#ifdef STATUS_LED_3
|
||||||
|
STATUS_LED_3(0);
|
||||||
|
#endif
|
||||||
|
#ifdef STATUS_LED_4
|
||||||
|
STATUS_LED_4(0);
|
||||||
|
#endif
|
||||||
|
#ifdef STATUS_LED_5
|
||||||
|
STATUS_LED_5(0);
|
||||||
|
#endif
|
||||||
|
#ifdef STATUS_LED_6
|
||||||
|
STATUS_LED_6(0);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
uint8_t event[RAW_EPSIZE];
|
uint8_t event[RAW_EPSIZE];
|
||||||
event[0] = ORYX_EVT_STATUS_LED_CONTROL;
|
event[0] = ORYX_EVT_STATUS_LED_CONTROL;
|
||||||
event[1] = rawhid_state.status_led_control;
|
event[1] = rawhid_state.status_led_control;
|
||||||
|
|||||||
@@ -191,12 +191,12 @@ void matrix_power_up(void) {
|
|||||||
|
|
||||||
is_launching = temp_launching;
|
is_launching = temp_launching;
|
||||||
if (!is_launching) {
|
if (!is_launching) {
|
||||||
ML_LED_1(false);
|
STATUS_LED_1(false);
|
||||||
ML_LED_2(false);
|
STATUS_LED_2(false);
|
||||||
ML_LED_3(false);
|
STATUS_LED_3(false);
|
||||||
ML_LED_4(false);
|
STATUS_LED_4(false);
|
||||||
ML_LED_5(false);
|
STATUS_LED_5(false);
|
||||||
ML_LED_6(false);
|
STATUS_LED_6(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize matrix state: all keys off
|
// initialize matrix state: all keys off
|
||||||
|
|||||||
@@ -31,14 +31,14 @@ static uint32_t dynamic_macro_led(uint32_t trigger_time, void *cb_arg) {
|
|||||||
static bool led_state = true;
|
static bool led_state = true;
|
||||||
if (!is_launching) {
|
if (!is_launching) {
|
||||||
led_state = !led_state;
|
led_state = !led_state;
|
||||||
ML_LED_3(led_state);
|
STATUS_LED_3(led_state);
|
||||||
}
|
}
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dynamic_macro_record_start_user(int8_t direction) {
|
void dynamic_macro_record_start_user(int8_t direction) {
|
||||||
if (dynamic_macro_token == INVALID_DEFERRED_TOKEN) {
|
if (dynamic_macro_token == INVALID_DEFERRED_TOKEN) {
|
||||||
ML_LED_3(true);
|
STATUS_LED_3(true);
|
||||||
dynamic_macro_token = defer_exec(100, dynamic_macro_led, NULL);
|
dynamic_macro_token = defer_exec(100, dynamic_macro_led, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ void dynamic_macro_record_start_user(int8_t direction) {
|
|||||||
void dynamic_macro_record_end_user(int8_t direction) {
|
void dynamic_macro_record_end_user(int8_t direction) {
|
||||||
if (cancel_deferred_exec(dynamic_macro_token)) {
|
if (cancel_deferred_exec(dynamic_macro_token)) {
|
||||||
dynamic_macro_token = INVALID_DEFERRED_TOKEN;
|
dynamic_macro_token = INVALID_DEFERRED_TOKEN;
|
||||||
ML_LED_3(false);
|
STATUS_LED_3(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
@@ -56,45 +56,45 @@ static uint32_t startup_exec(uint32_t trigger_time, void *cb_arg) {
|
|||||||
|
|
||||||
switch (startup_loop++) {
|
switch (startup_loop++) {
|
||||||
case 0:
|
case 0:
|
||||||
ML_LED_1(true);
|
STATUS_LED_1(true);
|
||||||
ML_LED_2(false);
|
STATUS_LED_2(false);
|
||||||
ML_LED_3(false);
|
STATUS_LED_3(false);
|
||||||
ML_LED_4(false);
|
STATUS_LED_4(false);
|
||||||
ML_LED_5(false);
|
STATUS_LED_5(false);
|
||||||
ML_LED_6(false);
|
STATUS_LED_6(false);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ML_LED_2(true);
|
STATUS_LED_2(true);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ML_LED_3(true);
|
STATUS_LED_3(true);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
ML_LED_4(true);
|
STATUS_LED_4(true);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
ML_LED_5(true);
|
STATUS_LED_5(true);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
ML_LED_6(true);
|
STATUS_LED_6(true);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
ML_LED_1(false);
|
STATUS_LED_1(false);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
ML_LED_2(false);
|
STATUS_LED_2(false);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
ML_LED_3(false);
|
STATUS_LED_3(false);
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
ML_LED_4(false);
|
STATUS_LED_4(false);
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
ML_LED_5(false);
|
STATUS_LED_5(false);
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
ML_LED_6(false);
|
STATUS_LED_6(false);
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
is_launching = false;
|
is_launching = false;
|
||||||
@@ -121,6 +121,9 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
|
|||||||
#if !defined(MOONLANDER_USER_LEDS)
|
#if !defined(MOONLANDER_USER_LEDS)
|
||||||
state = layer_state_set_user(state);
|
state = layer_state_set_user(state);
|
||||||
if (is_launching || !keyboard_config.led_level) return state;
|
if (is_launching || !keyboard_config.led_level) return state;
|
||||||
|
#ifdef ORYX_ENABLE
|
||||||
|
if (rawhid_state.status_led_control) return state;
|
||||||
|
#endif
|
||||||
bool LED_1 = false;
|
bool LED_1 = false;
|
||||||
bool LED_2 = false;
|
bool LED_2 = false;
|
||||||
bool LED_3 = false;
|
bool LED_3 = false;
|
||||||
@@ -161,13 +164,13 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ML_LED_1(LED_1);
|
STATUS_LED_1(LED_1);
|
||||||
ML_LED_2(LED_2);
|
STATUS_LED_2(LED_2);
|
||||||
ML_LED_3(LED_3);
|
STATUS_LED_3(LED_3);
|
||||||
ML_LED_4(LED_4);
|
STATUS_LED_4(LED_4);
|
||||||
ML_LED_5(LED_5);
|
STATUS_LED_5(LED_5);
|
||||||
#if !defined(CAPS_LOCK_STATUS)
|
#if !defined(CAPS_LOCK_STATUS)
|
||||||
ML_LED_6(LED_6);
|
STATUS_LED_6(LED_6);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef ORYX_ENABLE
|
#ifdef ORYX_ENABLE
|
||||||
@@ -330,7 +333,7 @@ const uint8_t music_map[MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
|
|
||||||
#ifdef CAPS_LOCK_STATUS
|
#ifdef CAPS_LOCK_STATUS
|
||||||
void led_update_ports(led_t led_state) {
|
void led_update_ports(led_t led_state) {
|
||||||
ML_LED_6(led_state.caps_lock);
|
STATUS_LED_6(led_state.caps_lock);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -345,12 +348,12 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
|||||||
if (keyboard_config.led_level) {
|
if (keyboard_config.led_level) {
|
||||||
layer_state_set_kb(layer_state);
|
layer_state_set_kb(layer_state);
|
||||||
} else {
|
} else {
|
||||||
ML_LED_1(false);
|
STATUS_LED_1(false);
|
||||||
ML_LED_2(false);
|
STATUS_LED_2(false);
|
||||||
ML_LED_3(false);
|
STATUS_LED_3(false);
|
||||||
ML_LED_4(false);
|
STATUS_LED_4(false);
|
||||||
ML_LED_5(false);
|
STATUS_LED_5(false);
|
||||||
ML_LED_6(false);
|
STATUS_LED_6(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ extern bool mcp23018_leds[];
|
|||||||
|
|
||||||
#define MCP23018_DEFAULT_ADDRESS 0b0100000
|
#define MCP23018_DEFAULT_ADDRESS 0b0100000
|
||||||
|
|
||||||
#define ML_LED_1(status) gpio_write_pin(B5, (bool)status)
|
#define STATUS_LED_1(status) gpio_write_pin(B5, (bool)status)
|
||||||
#define ML_LED_2(status) gpio_write_pin(B4, (bool)status)
|
#define STATUS_LED_2(status) gpio_write_pin(B4, (bool)status)
|
||||||
#define ML_LED_3(status) gpio_write_pin(B3, (bool)status)
|
#define STATUS_LED_3(status) gpio_write_pin(B3, (bool)status)
|
||||||
|
|
||||||
#define ML_LED_4(status) mcp23018_leds[0] = (bool)status
|
#define STATUS_LED_4(status) mcp23018_leds[0] = (bool)status
|
||||||
#define ML_LED_5(status) mcp23018_leds[1] = (bool)status
|
#define STATUS_LED_5(status) mcp23018_leds[1] = (bool)status
|
||||||
#define ML_LED_6(status) mcp23018_leds[2] = (bool)status
|
#define STATUS_LED_6(status) mcp23018_leds[2] = (bool)status
|
||||||
|
|
||||||
enum planck_ez_keycodes {
|
enum planck_ez_keycodes {
|
||||||
TOGGLE_LAYER_COLOR = QK_KB_0,
|
TOGGLE_LAYER_COLOR = QK_KB_0,
|
||||||
|
|||||||
@@ -97,16 +97,20 @@ layer_state_t layer_state_set_kb(layer_state_t state) {
|
|||||||
#if !defined(VOYAGER_USER_LEDS)
|
#if !defined(VOYAGER_USER_LEDS)
|
||||||
state = layer_state_set_user(state);
|
state = layer_state_set_user(state);
|
||||||
if (is_launching || !keyboard_config.led_level) return state;
|
if (is_launching || !keyboard_config.led_level) return state;
|
||||||
|
#ifdef ORYX_ENABLE
|
||||||
|
if (rawhid_state.status_led_control) return state;
|
||||||
|
#endif
|
||||||
uint8_t layer = get_highest_layer(state);
|
uint8_t layer = get_highest_layer(state);
|
||||||
|
|
||||||
STATUS_LED_1(layer & (1 << 0));
|
if(!rawhid_state.status_led_control) {
|
||||||
STATUS_LED_2(layer & (1 << 1));
|
STATUS_LED_1(layer & (1 << 0));
|
||||||
STATUS_LED_3(layer & (1 << 2));
|
STATUS_LED_2(layer & (1 << 1));
|
||||||
|
STATUS_LED_3(layer & (1 << 2));
|
||||||
|
|
||||||
# if !defined(CAPS_LOCK_STATUS)
|
# if !defined(CAPS_LOCK_STATUS)
|
||||||
STATUS_LED_4(layer & (1 << 3));
|
STATUS_LED_4(layer & (1 << 3));
|
||||||
# endif
|
# endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef ORYX_ENABLE
|
#ifdef ORYX_ENABLE
|
||||||
layer_state_set_oryx(state);
|
layer_state_set_oryx(state);
|
||||||
|
|||||||
Reference in New Issue
Block a user