Expose IsHostSleeping instead of IsHostSleeping()

This commit is contained in:
László Monda
2018-04-28 13:11:25 +02:00
parent 3d4d78387e
commit ec8301ae62
3 changed files with 6 additions and 10 deletions

View File

@@ -163,16 +163,12 @@ static usb_device_class_config_list_struct_t UsbDeviceCompositeConfigList = {
}
}};
static bool isHostSleeping = false;
bool IsHostSleeping = false;
static uint8_t oldKeyBacklightBrightness = 0xFF;
static bool capsLockOn = false, agentOn = false, adaptiveOn = false;
bool IsHostSleeping(void) {
return isHostSleeping;
}
static void suspendHost(void) {
isHostSleeping = true;
IsHostSleeping = true;
// Save the state of the icons
capsLockOn = LedDisplay_GetIcon(LedDisplayIcon_CapsLock);
agentOn = LedDisplay_GetIcon(LedDisplayIcon_Agent);
@@ -197,7 +193,7 @@ void WakeUpHost(bool sendResume) {
USB_DeviceSetStatus(UsbCompositeDevice.deviceHandle, kUSB_DeviceStatusBus, NULL);
}
isHostSleeping = false; // The computer is now awake
IsHostSleeping = false; // The computer is now awake
// Restore keyboard backlight and text
KeyBacklightBrightness = oldKeyBacklightBrightness;
@@ -223,7 +219,7 @@ static usb_status_t usbDeviceCallback(usb_device_handle handle, uint32_t event,
return status;
}
if (isHostSleeping) {
if (IsHostSleeping) {
WakeUpHost(false); // Wake up the keyboard if there is any activity on the bus.
}

View File

@@ -28,12 +28,12 @@
// Variables:
extern bool IsHostSleeping;
extern usb_composite_device_t UsbCompositeDevice;
//Functions:
void InitUsb(void);
bool IsHostSleeping(void);
void WakeUpHost(bool sendResume);
#endif

View File

@@ -428,7 +428,7 @@ void UpdateUsbReports(void)
IsUsbMouseReportSent = false;
}
if ((previousLayer != LayerId_Base || !IsUsbBasicKeyboardReportSent || !IsUsbMediaKeyboardReportSent || !IsUsbSystemKeyboardReportSent || !IsUsbMouseReportSent) && IsHostSleeping()) {
if ((previousLayer != LayerId_Base || !IsUsbBasicKeyboardReportSent || !IsUsbMediaKeyboardReportSent || !IsUsbSystemKeyboardReportSent || !IsUsbMouseReportSent) && IsHostSleeping) {
WakeUpHost(true); // Wake up the computer if any key is pressed and the computer is sleeping.
}
}