Various keyboard fixes (#18649)
This commit is contained in:
parent
85dc473faa
commit
48093000e1
7 changed files with 14 additions and 59 deletions
|
@ -17,7 +17,7 @@
|
||||||
#include "sandbox.h"
|
#include "sandbox.h"
|
||||||
|
|
||||||
#ifdef OLED_ENABLE
|
#ifdef OLED_ENABLE
|
||||||
bool oled_task_user(void) {
|
bool oled_task_kb(void) {
|
||||||
if (!oled_task_user()) { return false; }
|
if (!oled_task_user()) { return false; }
|
||||||
switch (get_highest_layer(layer_state)) {
|
switch (get_highest_layer(layer_state)) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
|
@ -6,6 +6,6 @@ void backlight_init_ports(void);
|
||||||
void backlight_set_state(bool cfg[7]);
|
void backlight_set_state(bool cfg[7]);
|
||||||
void backlight_update_state(void);
|
void backlight_update_state(void);
|
||||||
void backlight_toggle_rgb(bool enabled);
|
void backlight_toggle_rgb(bool enabled);
|
||||||
void backlight_set_rgb(uint8_t cfg[17][3]);
|
void backlight_set_rgb(uint8_t cfg[RGBLED_NUM][3]);
|
||||||
void backlight_set(uint8_t level);
|
void backlight_set(uint8_t level);
|
||||||
void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device);
|
void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device);
|
||||||
|
|
|
@ -44,61 +44,16 @@ uint8_t backlight_state_led = 1<<STATE_LED_LAYER_0;
|
||||||
|
|
||||||
void backlight_toggle_rgb(bool enabled)
|
void backlight_toggle_rgb(bool enabled)
|
||||||
{
|
{
|
||||||
|
uint8_t rgb[RGBLED_NUM][3] = { 0 };
|
||||||
|
|
||||||
if(enabled) {
|
if(enabled) {
|
||||||
uint8_t rgb[RGBLED_NUM][3] = {
|
for(uint8_t i = 0; i < RGBLED_NUM; ++i) {
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
rgb[i][0] = backlight_rgb_r;
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
rgb[i][1] = backlight_rgb_g;
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
rgb[i][2] = backlight_rgb_b;
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
}
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
|
|
||||||
{backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}
|
|
||||||
};
|
|
||||||
backlight_set_rgb(rgb);
|
|
||||||
} else {
|
|
||||||
uint8_t rgb[RGBLED_NUM][3] = {
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0},
|
|
||||||
{0, 0, 0}
|
|
||||||
};
|
|
||||||
backlight_set_rgb(rgb);
|
|
||||||
}
|
}
|
||||||
|
backlight_set_rgb(rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void backlight_set_rgb(uint8_t cfg[RGBLED_NUM][3])
|
void backlight_set_rgb(uint8_t cfg[RGBLED_NUM][3])
|
||||||
|
|
|
@ -113,7 +113,7 @@ void send_color(uint8_t r, uint8_t g, uint8_t b, enum Device device) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Port from backlight_set_state
|
// Port from backlight_set_state
|
||||||
void indicator_leds_set(bool leds[8]) {
|
void indicator_leds_set(bool leds[7]) {
|
||||||
cli();
|
cli();
|
||||||
send_color(leds[1] ? 255 : 0, leds[2] ? 255 : 0, leds[0] ? 255 : 0, Device_STATUSLED);
|
send_color(leds[1] ? 255 : 0, leds[2] ? 255 : 0, leds[0] ? 255 : 0, Device_STATUSLED);
|
||||||
send_color(leds[4] ? 255 : 0, leds[3] ? 255 : 0, leds[5] ? 255 : 0, Device_STATUSLED);
|
send_color(leds[4] ? 255 : 0, leds[3] ? 255 : 0, leds[5] ? 255 : 0, Device_STATUSLED);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "duck_led/duck_led.h"
|
#include "duck_led/duck_led.h"
|
||||||
|
|
||||||
void indicator_leds_set(bool leds[8]);
|
void indicator_leds_set(bool leds[7]);
|
||||||
void backlight_toggle_rgb(bool enabled);
|
void backlight_toggle_rgb(bool enabled);
|
||||||
void backlight_set_rgb(uint8_t cfg[17][3]);
|
void backlight_set_rgb(uint8_t cfg[17][3]);
|
||||||
void backlight_init_ports(void);
|
void backlight_init_ports(void);
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#ifdef OLED_ENABLE
|
#ifdef OLED_ENABLE
|
||||||
bool oled_task_kb(void) {
|
bool oled_task_kb(void) {
|
||||||
if (!oled_task_kb()) { return false; }
|
if (!oled_task_user()) { return false; }
|
||||||
// Host Keyboard Layer Status
|
// Host Keyboard Layer Status
|
||||||
oled_write_P(PSTR("Synthesis60\nLayer: "), false);
|
oled_write_P(PSTR("Synthesis60\nLayer: "), false);
|
||||||
// Host Keyboard LED Status
|
// Host Keyboard LED Status
|
||||||
|
|
|
@ -58,7 +58,7 @@ led_config_t g_led_config = {
|
||||||
};
|
};
|
||||||
|
|
||||||
bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
|
bool rgb_matrix_indicators_advanced_kb(uint8_t led_min, uint8_t led_max) {
|
||||||
if (!rgb_matrix_indicators_advanced_kb(led_min, led_max)) {
|
if (!rgb_matrix_indicators_advanced_user(led_min, led_max)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (rgb_matrix_is_enabled()) {
|
if (rgb_matrix_is_enabled()) {
|
||||||
|
|
Loading…
Reference in a new issue