Backlight - New option : BACKLIGHT_CAPS_LOCK (#4769)
* [BACKLIGHT_CAPS_LOCK_INDICATOR] Use backlight toggling as Caps Lock LED I've implemented this feature because S65-X doesn't have LED indicators and the existing led_set_kb(usb_led) function try to use backlight as indicator but that creates an inconsistency with backlight_config state. - define `BACKLIGHT_CAPS_LOCK_INDICATOR` to enable Caps Lock indicator using backlight (for keyboards without dedicated LED) - Don't turn off LED indicators when suspend because backlight is already turned off. Else led_set(0) will turn back on backlight. - Documentation has been updated * [BACKLIGHT_CAPS_LOCK_INDICATOR] Turn off all LED indicators except Caps Lock if BACKLIGHT_CAPS_LOCK_INDICATOR * [BACKLIGHT_CAPS_LOCK] Rename BACKLIGHT_CAPS_LOCK_INDICATOR * [BACKLIGHT_CAPS_LOCK] Use new IS_LED_ON method
This commit is contained in:
		
							parent
							
								
									0f507f0169
								
							
						
					
					
						commit
						df251d7a13
					
				
					 3 changed files with 50 additions and 24 deletions
				
			
		| 
						 | 
				
			
			@ -102,24 +102,31 @@ static uint8_t wdt_timeout = 0;
 | 
			
		|||
 */
 | 
			
		||||
static void power_down(uint8_t wdto) {
 | 
			
		||||
#ifdef PROTOCOL_LUFA
 | 
			
		||||
    if (USB_DeviceState == DEVICE_STATE_Configured) return;
 | 
			
		||||
  if (USB_DeviceState == DEVICE_STATE_Configured) return;
 | 
			
		||||
#endif
 | 
			
		||||
    wdt_timeout = wdto;
 | 
			
		||||
  wdt_timeout = wdto;
 | 
			
		||||
 | 
			
		||||
    // Watchdog Interrupt Mode
 | 
			
		||||
    wdt_intr_enable(wdto);
 | 
			
		||||
  // Watchdog Interrupt Mode
 | 
			
		||||
  wdt_intr_enable(wdto);
 | 
			
		||||
 | 
			
		||||
#ifdef BACKLIGHT_ENABLE
 | 
			
		||||
	backlight_set(0);
 | 
			
		||||
  backlight_set(0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	// Turn off LED indicators
 | 
			
		||||
	led_set(0);
 | 
			
		||||
  // Turn off LED indicators
 | 
			
		||||
  uint8_t leds_off = 0;
 | 
			
		||||
#if defined(BACKLIGHT_CAPS_LOCK) && defined(BACKLIGHT_ENABLE)
 | 
			
		||||
  if (is_backlight_enabled()) {
 | 
			
		||||
    // Don't try to turn off Caps Lock indicator as it is backlight and backlight is already off
 | 
			
		||||
    leds_off |= (1<<USB_LED_CAPS_LOCK);
 | 
			
		||||
  }
 | 
			
		||||
#endif
 | 
			
		||||
  led_set(leds_off);
 | 
			
		||||
 | 
			
		||||
	#ifdef AUDIO_ENABLE
 | 
			
		||||
        // This sometimes disables the start-up noise, so it's been disabled
 | 
			
		||||
		// stop_all_notes();
 | 
			
		||||
	#endif /* AUDIO_ENABLE */
 | 
			
		||||
#ifdef AUDIO_ENABLE
 | 
			
		||||
  // This sometimes disables the start-up noise, so it's been disabled
 | 
			
		||||
  // stop_all_notes();
 | 
			
		||||
#endif /* AUDIO_ENABLE */
 | 
			
		||||
#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
 | 
			
		||||
#ifdef RGBLIGHT_ANIMATIONS
 | 
			
		||||
  rgblight_timer_disable();
 | 
			
		||||
| 
						 | 
				
			
			@ -135,20 +142,20 @@ static void power_down(uint8_t wdto) {
 | 
			
		|||
#endif
 | 
			
		||||
  suspend_power_down_kb();
 | 
			
		||||
 | 
			
		||||
    // TODO: more power saving
 | 
			
		||||
    // See PicoPower application note
 | 
			
		||||
    // - I/O port input with pullup
 | 
			
		||||
    // - prescale clock
 | 
			
		||||
    // - BOD disable
 | 
			
		||||
    // - Power Reduction Register PRR
 | 
			
		||||
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);
 | 
			
		||||
    sleep_enable();
 | 
			
		||||
    sei();
 | 
			
		||||
    sleep_cpu();
 | 
			
		||||
    sleep_disable();
 | 
			
		||||
  // TODO: more power saving
 | 
			
		||||
  // See PicoPower application note
 | 
			
		||||
  // - I/O port input with pullup
 | 
			
		||||
  // - prescale clock
 | 
			
		||||
  // - BOD disable
 | 
			
		||||
  // - Power Reduction Register PRR
 | 
			
		||||
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
 | 
			
		||||
  sleep_enable();
 | 
			
		||||
  sei();
 | 
			
		||||
  sleep_cpu();
 | 
			
		||||
  sleep_disable();
 | 
			
		||||
 | 
			
		||||
    // Disable watchdog after sleep
 | 
			
		||||
    wdt_disable();
 | 
			
		||||
  // Disable watchdog after sleep
 | 
			
		||||
  wdt_disable();
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue