Remove remaining rgblight_set() overrides

This commit is contained in:
fauxpark 2023-11-22 19:22:03 +11:00
parent 068f56d361
commit 16b6cf6ee3
4 changed files with 13 additions and 46 deletions

View File

@ -22,45 +22,42 @@ extern rgblight_config_t rgblight_config;
#endif #endif
rgb_led_t noah_leds[RGBLED_NUM]; rgb_led_t noah_leds[RGBLED_NUM];
static bool noah_led_mode = false; static bool noah_led_mode = false;
void rgblight_set(void) { void setleds_custom(rgb_led_t *ledarray, uint16_t num_leds) {
memset(&noah_leds[0], 0, sizeof(noah_leds)); memset(&noah_leds[0], 0, sizeof(noah_leds));
if (!rgblight_config.enable) { if (!rgblight_config.enable) {
for (uint8_t i = 0; i < RGBLED_NUM; i++) { for (uint8_t i = 0; i < RGBLED_NUM; i++) {
led[i].r = 0; ledarray[i].r = 0;
led[i].g = 0; ledarray[i].g = 0;
led[i].b = 0; ledarray[i].b = 0;
} }
} }
if (noah_led_mode) { if (noah_led_mode) {
led_t led_state = host_keyboard_led_state(); led_t led_state = host_keyboard_led_state();
if (led_state.caps_lock) { if (led_state.caps_lock) {
noah_leds[0] = led[0]; noah_leds[0] = ledarray[0];
} }
if (led_state.scroll_lock) { if (led_state.scroll_lock) {
noah_leds[1] = led[1]; noah_leds[1] = ledarray[1];
} }
if (led_state.num_lock) { if (led_state.num_lock) {
noah_leds[2] = led[2]; noah_leds[2] = ledarray[2];
} }
for (int32_t i = 0; i < 4; i++) { for (int32_t i = 0; i < 4; i++) {
if(layer_state_is(i+1)) { if(layer_state_is(i+1)) {
noah_leds[i + 3] = led[i + 3]; noah_leds[i + 3] = ledarray[i + 3];
} }
} }
} else { } else {
memcpy(&noah_leds[0], &led[0], sizeof(noah_leds)); memcpy(&noah_leds[0], &ledarray[0], sizeof(noah_leds));
} }
ws2812_setleds(noah_leds, RGBLED_NUM); ws2812_setleds(noah_leds, RGBLED_NUM);
} }
#endif
void matrix_scan_kb(void) { const rgblight_driver_t rgblight_driver = {
#ifdef RGBLIGHT_ENABLE .setleds = setleds_custom,
rgblight_task(); };
#endif #endif
matrix_scan_user();
}
#ifdef RGB_MATRIX_ENABLE #ifdef RGB_MATRIX_ENABLE
const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = { const is31fl3731_led_t PROGMEM g_is31fl3731_leds[RGB_MATRIX_LED_COUNT] = {

View File

@ -18,22 +18,6 @@
"pin": "F7", "pin": "F7",
"on_state": 0 "on_state": 0
}, },
"rgblight": {
"driver": "custom",
"led_count": 1,
"animations": {
"breathing": true,
"rainbow_mood": true,
"rainbow_swirl": true,
"snake": true,
"knight": true,
"christmas": true,
"static_gradient": true,
"rgb_test": true,
"alternating": true,
"twinkle": true
}
},
"processor": "atmega32u4", "processor": "atmega32u4",
"bootloader": "atmel-dfu", "bootloader": "atmel-dfu",
"community_layouts": ["60_ansi", "60_iso"], "community_layouts": ["60_ansi", "60_iso"],

View File

@ -8,7 +8,7 @@ CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = no # Enable N-Key Rollover NKRO_ENABLE = no # Enable N-Key Rollover
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes # Enable the RGB Underglow RGBLIGHT_ENABLE = no # Enable the RGB Underglow
AUDIO_ENABLE = no # Audio output AUDIO_ENABLE = no # Audio output
LTO_ENABLE = yes LTO_ENABLE = yes

View File

@ -131,20 +131,6 @@ void set_rgb_pin_off(uint8_t pin) {
PORTF |= _BV(pin); PORTF |= _BV(pin);
} }
void rgblight_set(void) {
// xprintf("Setting RGB underglow\n");
if (!rgblight_config.enable) {
led[0].r = 0;
led[0].g = 0;
led[0].b = 0;
set_rgb_pin_off(RGB_RED_PIN);
set_rgb_pin_off(RGB_GREEN_PIN);
set_rgb_pin_off(RGB_BLUE_PIN);
}
// //xprintf("Red: %u, Green: %u, Blue: %u\n", led[0].r, led[0].g, led[0].b);
}
ISR(TIMER3_COMPA_vect) ISR(TIMER3_COMPA_vect)
{ {
static uint8_t pwm = 0; static uint8_t pwm = 0;