/* for split keyboard slave side */ void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom) { if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_MODE) { if (syncinfo->config.enable) { rgblight_config.enable = 1; // == rgblight_enable_noeeprom(); rgblight_mode_eeprom_helper(syncinfo->config.mode, write_to_eeprom); } else { rgblight_disable_noeeprom(); } } if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_HSVS) { rgblight_sethsv_eeprom_helper(syncinfo->config.hue, syncinfo->config.sat, syncinfo->config.val, write_to_eeprom); // rgblight_config.speed = config->speed; // NEED??? } #ifdef RGBLIGHT_USE_TIMER if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_TIMER) { if (syncinfo->status.timer_enabled) { rgblight_timer_enable(); } else { rgblight_timer_disable(); } } #ifndef RGBLIGHT_SPLIT_NO_ANIMATION_SYNC if (syncinfo->status.change_flags & RGBLIGHT_STATUS_ANIMATION_TICK) { animation_status.restart = true; } #endif /* RGBLIGHT_SPLIT_NO_ANIMATION_SYNC */ #endif /* RGBLIGHT_USE_TIMER */ }
void rgblight_mode(uint8_t mode) { if (!rgblight_config.enable) { return; } if (mode < 1) { rgblight_config.mode = 1; } else if (mode > RGBLIGHT_MODES) { rgblight_config.mode = RGBLIGHT_MODES; } else { rgblight_config.mode = mode; } eeconfig_update_rgblight(rgblight_config.raw); xprintf("rgblight mode: %u\n", rgblight_config.mode); if (rgblight_config.mode == 1) { #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); #endif } else if (rgblight_config.mode >= 2 && rgblight_config.mode <= 23) { // MODE 2-5, breathing // MODE 6-8, rainbow mood // MODE 9-14, rainbow swirl // MODE 15-20, snake // MODE 21-23, knight #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_enable(); #endif } rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); }
void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { if (!rgblight_config.enable) { return; } if (mode < RGBLIGHT_MODE_STATIC_LIGHT) { rgblight_config.mode = RGBLIGHT_MODE_STATIC_LIGHT; } else if (mode > RGBLIGHT_MODES) { rgblight_config.mode = RGBLIGHT_MODES; } else { rgblight_config.mode = mode; } RGBLIGHT_SPLIT_SET_CHANGE_MODE; if (write_to_eeprom) { eeconfig_update_rgblight(rgblight_config.raw); xprintf("rgblight mode [EEPROM]: %u\n", rgblight_config.mode); } else { xprintf("rgblight mode [NOEEPROM]: %u\n", rgblight_config.mode); } if( is_static_effect(rgblight_config.mode) ) { #ifdef RGBLIGHT_USE_TIMER rgblight_timer_disable(); #endif } else { #ifdef RGBLIGHT_USE_TIMER rgblight_timer_enable(); #endif } #ifdef RGBLIGHT_USE_TIMER animation_status.restart = true; #endif rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); }
void rgblight_timer_toggle(void) { dprintf("rgblight timer toggle.\n"); if(rgblight_status.timer_enabled) { rgblight_timer_disable(); } else { rgblight_timer_enable(); } }
void rgblight_disable_noeeprom(void) { rgblight_config.enable = 0; xprintf("rgblight disable [noEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); #endif _delay_ms(50); rgblight_set(); }
void rgblight_disable(void) { rgblight_config.enable = 0; eeconfig_update_rgblight(rgblight_config.raw); xprintf("rgblight disable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); #endif wait_ms(50); rgblight_set(); }
void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { if (!rgblight_config.enable) { return; } if (mode < 1) { rgblight_config.mode = 1; } else if (mode > RGBLIGHT_MODES) { rgblight_config.mode = RGBLIGHT_MODES; } else { rgblight_config.mode = mode; } if (write_to_eeprom) { eeconfig_update_rgblight(rgblight_config.raw); xprintf("rgblight mode [EEPROM]: %u\n", rgblight_config.mode); } else { xprintf("rgblight mode [NOEEPROM]: %u\n", rgblight_config.mode); } if (rgblight_config.mode == 1) { #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); #endif } else if ((rgblight_config.mode >= 2 && rgblight_config.mode <= 24) || rgblight_config.mode == 35 ) { // MODE 2-5, breathing // MODE 6-8, rainbow mood // MODE 9-14, rainbow swirl // MODE 15-20, snake // MODE 21-23, knight // MODE 24, xmas // MODE 35 RGB test #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_enable(); #endif } else if (rgblight_config.mode >= 25 && rgblight_config.mode <= 34) { // MODE 25-34, static gradient #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); #endif } rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, rgblight_config.val); }
void rgblight_disable_noeeprom(void) { rgblight_config.enable = 0; xprintf("rgblight disable [noEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); #ifdef RGBLIGHT_USE_TIMER rgblight_timer_disable(); #endif RGBLIGHT_SPLIT_SET_CHANGE_MODE; wait_ms(50); rgblight_set(); }
void rgblight_disable(void) { rgblight_config.enable = 0; eeconfig_update_rgblight(rgblight_config.raw); xprintf("rgblight disable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); #ifdef RGBLIGHT_USE_TIMER rgblight_timer_disable(); #endif RGBLIGHT_SPLIT_SET_CHANGE_MODE; wait_ms(50); rgblight_set(); }
void rgblight_update_dword(uint32_t dword) { rgblight_config.raw = dword; if (rgblight_config.enable) rgblight_mode_noeeprom(rgblight_config.mode); else { #ifdef RGBLIGHT_USE_TIMER rgblight_timer_disable(); #endif rgblight_set(); } }
void rgblight_update_dword(uint32_t dword) { rgblight_config.raw = dword; eeconfig_update_rgblight(rgblight_config.raw); if (rgblight_config.enable) rgblight_mode(rgblight_config.mode); else { #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); #endif rgblight_set(); } }
void rgblight_toggle(void) { rgblight_config.enable ^= 1; eeconfig_update_rgblight(rgblight_config.raw); xprintf("rgblight toggle: rgblight_config.enable = %u\n", rgblight_config.enable); if (rgblight_config.enable) { rgblight_mode(rgblight_config.mode); } else { #ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); #endif _delay_ms(50); rgblight_set(); } }