]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - quantum/rgblight.c
Merge pull request #932 from climbalima/master
[qmk_firmware.git] / quantum / rgblight.c
index 6b58f665471634443712c54d3d7bd5512a47ac7e..625971e0fe616d33dab4211a0df12902d169e37c 100644 (file)
@@ -183,6 +183,19 @@ void rgblight_init(void) {
   }
 }
 
+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_increase(void) {
   uint8_t mode = 0;
   if (rgblight_config.mode < RGBLIGHT_MODES) {
@@ -253,6 +266,13 @@ void rgblight_toggle(void) {
   }
 }
 
+void rgblight_enable(void) {
+  rgblight_config.enable = 1;
+  eeconfig_update_rgblight(rgblight_config.raw);
+  xprintf("rgblight enable: rgblight_config.enable = %u\n", rgblight_config.enable);
+  rgblight_mode(rgblight_config.mode);
+}
+
 
 void rgblight_increase_hue(void) {
   uint16_t hue;
@@ -405,6 +425,12 @@ void rgblight_timer_toggle(void) {
   dprintf("TIMER3 toggled.\n");
 }
 
+void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b) {
+  rgblight_enable();
+  rgblight_mode(1);
+  rgblight_setrgb(r, g, b);
+}
+
 void rgblight_task(void) {
   if (rgblight_timer_enabled) {
     // mode = 1, static light, do nothing here