The layer keys can now also wake up the computer

This commit is contained in:
Kristian Sloth Lauszus
2018-03-11 19:29:24 +01:00
parent 5d59540c51
commit c109a9e202
4 changed files with 10 additions and 3 deletions

View File

@@ -90,7 +90,7 @@ void LedDisplay_SetCurrentKeymapText(void)
LedDisplay_SetText(currentKeymap->abbreviationLen, currentKeymap->abbreviation);
}
void LedDisplay_SetLayer(uint8_t layerId)
void LedDisplay_SetLayer(layer_id_t layerId)
{
for (uint8_t i = 13; i <= 45; i += 16) {
LedDriverValues[LedDriverId_Left][i] = 0;

View File

@@ -5,6 +5,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "layer.h"
// Typedefs:
@@ -23,7 +24,7 @@
void LedDisplay_SetText(uint8_t length, const char* text);
void LedDisplay_SetCurrentKeymapText(void);
void LedDisplay_SetLayer(uint8_t layerId);
void LedDisplay_SetLayer(layer_id_t layerId);
void LedDisplay_SetIcon(led_display_icon_t icon, bool isEnabled);
bool LedDisplay_GetIcon(led_display_icon_t icon);

View File

@@ -187,6 +187,9 @@ static void ComputerIsSleeping(void) {
LedSlaveDriver_Init(LedDriverId_Right);
LedSlaveDriver_Init(LedDriverId_Left);
// Turn layer LEDs off
LedDisplay_SetLayer(LayerId_Base);
// Clear the text
LedDisplay_SetText(0, NULL);
#endif
@@ -204,6 +207,9 @@ void WakeupComputer(bool sendResume) {
LedSlaveDriver_Init(LedDriverId_Right);
LedSlaveDriver_Init(LedDriverId_Left);
// Update the active layer
LedDisplay_SetLayer(GetActiveLayer());
// Restore icon states
LedDisplay_SetIcon(LedDisplayIcon_CapsLock, capsLockOn);
LedDisplay_SetIcon(LedDisplayIcon_Agent, agentOn);

View File

@@ -453,7 +453,7 @@ void UpdateUsbReports(void)
IsUsbMouseReportSent = false;
}
if ((!IsUsbBasicKeyboardReportSent || !IsUsbMediaKeyboardReportSent || !IsUsbSystemKeyboardReportSent || !IsUsbMouseReportSent) && IsComputerSleeping())
if ((previousLayer != LayerId_Base || !IsUsbBasicKeyboardReportSent || !IsUsbMediaKeyboardReportSent || !IsUsbSystemKeyboardReportSent || !IsUsbMouseReportSent) && IsComputerSleeping())
WakeupComputer(true); // Wake up the computer if any key is pressed and the computer is sleeping
Timer_SetCurrentTime(&lastUsbUpdateTime);