Don't reinitialize LED driver ICs upon suspend and resume.
This commit is contained in:
@@ -145,7 +145,7 @@ parser_error_t ParseConfig(config_buffer_t *buffer)
|
||||
AlphanumericSegmentsBrightness = alphanumericSegmentsBrightness;
|
||||
KeyBacklightBrightness = keyBacklightBrightness;
|
||||
|
||||
LedSlaveDriver_UpdateLedValues();
|
||||
LedSlaveDriver_UpdateLeds();
|
||||
|
||||
// Update mouse key speeds
|
||||
|
||||
|
||||
@@ -62,7 +62,14 @@ static uint8_t setShutdownModeNormalBuffer[] = {LED_DRIVER_REGISTER_SHUTDOWN, SH
|
||||
static uint8_t setFrame1Buffer[] = {LED_DRIVER_REGISTER_FRAME, LED_DRIVER_FRAME_1};
|
||||
static uint8_t updatePwmRegistersBuffer[PWM_REGISTER_BUFFER_LENGTH];
|
||||
|
||||
void LedSlaveDriver_UpdateLedValues(void)
|
||||
void LedSlaveDriver_DisableLeds(void)
|
||||
{
|
||||
for (uint8_t ledDriverId=0; ledDriverId<=LedDriverId_Last; ledDriverId++) {
|
||||
memset(LedDriverValues[ledDriverId], 0, LED_DRIVER_LED_COUNT);
|
||||
}
|
||||
}
|
||||
|
||||
void LedSlaveDriver_UpdateLeds(void)
|
||||
{
|
||||
for (uint8_t ledDriverId=0; ledDriverId<=LedDriverId_Last; ledDriverId++) {
|
||||
memset(LedDriverValues[ledDriverId], KeyBacklightBrightness, LED_DRIVER_LED_COUNT);
|
||||
|
||||
@@ -50,7 +50,8 @@
|
||||
|
||||
// Functions:
|
||||
|
||||
void LedSlaveDriver_UpdateLedValues(void);
|
||||
void LedSlaveDriver_DisableLeds(void);
|
||||
void LedSlaveDriver_UpdateLeds(void);
|
||||
void LedSlaveDriver_Init(uint8_t ledDriverId);
|
||||
status_t LedSlaveDriver_Update(uint8_t ledDriverId);
|
||||
|
||||
|
||||
@@ -164,22 +164,10 @@ static usb_device_class_config_list_struct_t UsbDeviceCompositeConfigList = {
|
||||
}};
|
||||
|
||||
bool IsHostSleeping = false;
|
||||
static uint8_t oldKeyBacklightBrightness = 0xFF;
|
||||
|
||||
static void suspendHost(void) {
|
||||
IsHostSleeping = true;
|
||||
|
||||
// Disable keyboard backlight
|
||||
oldKeyBacklightBrightness = KeyBacklightBrightness;
|
||||
KeyBacklightBrightness = 0;
|
||||
LedSlaveDriver_Init(LedDriverId_Right);
|
||||
LedSlaveDriver_Init(LedDriverId_Left);
|
||||
|
||||
// Turn layer LEDs off
|
||||
LedDisplay_SetLayer(LayerId_Base);
|
||||
|
||||
// Clear the text
|
||||
LedDisplay_SetText(0, NULL);
|
||||
LedSlaveDriver_DisableLeds();
|
||||
}
|
||||
|
||||
void WakeUpHost(bool sendResume) {
|
||||
@@ -188,18 +176,8 @@ void WakeUpHost(bool sendResume) {
|
||||
USB_DeviceSetStatus(UsbCompositeDevice.deviceHandle, kUSB_DeviceStatusBus, NULL);
|
||||
}
|
||||
|
||||
IsHostSleeping = false; // The host is now awake.
|
||||
|
||||
// Restore keyboard backlight and text
|
||||
KeyBacklightBrightness = oldKeyBacklightBrightness;
|
||||
LedSlaveDriver_Init(LedDriverId_Right);
|
||||
LedSlaveDriver_Init(LedDriverId_Left);
|
||||
|
||||
// Update the active layer
|
||||
LedDisplay_SetLayer(GetActiveLayer());
|
||||
|
||||
// Restore icon states
|
||||
LedDisplay_UpdateIcons();
|
||||
IsHostSleeping = false;
|
||||
LedSlaveDriver_UpdateLeds();
|
||||
}
|
||||
|
||||
static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event, void *param)
|
||||
|
||||
Reference in New Issue
Block a user