#include "host_driver.h"
#include "keyboard.h"
#include "action.h"
+#include "action_util.h"
+#include "mousekey.h"
#include "led.h"
#include "sendchar.h"
#include "debug.h"
/* Main loop */
while(true) {
- /* TODO: check for suspended event */
+
+ if(USB_DRIVER.state == USB_SUSPENDED) {
+ print("[s]");
+ while(USB_DRIVER.state == USB_SUSPENDED) {
+ /* Do this in the suspended state */
+ suspend_power_down(); // on AVR this deep sleeps for 15ms
+ /* Remote wakeup */
+ if((USB_DRIVER.status & 2) && suspend_wakeup_condition()) {
+ send_remote_wakeup(&USB_DRIVER);
+ }
+ }
+ /* Woken up */
+ // variables has been already cleared by the wakeup hook
+ send_keyboard_report();
+#ifdef MOUSEKEY_ENABLE
+ mousekey_send();
+#endif /* MOUSEKEY_ENABLE */
+ }
keyboard_task();
chThdSleepMilliseconds(5);