V-USB remote wakeup (#7627)
* V-USB remote wakeup Backport from tmk/tmk_keyboard@391c979be7 * Change vusb.c remote wake config as per fauxpark's suggestion
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "timer.h"
|
||||
#include "uart.h"
|
||||
#include "debug.h"
|
||||
#include "suspend.h"
|
||||
#ifdef SLEEP_LED_ENABLE
|
||||
# include "sleep_led.h"
|
||||
#endif
|
||||
@@ -41,6 +42,23 @@ static void initForUsbConnectivity(void) {
|
||||
sei();
|
||||
}
|
||||
|
||||
void usb_remote_wakeup(void) {
|
||||
cli();
|
||||
|
||||
int8_t ddr_orig = USBDDR;
|
||||
USBOUT |= (1 << USBMINUS);
|
||||
USBDDR = ddr_orig | USBMASK;
|
||||
USBOUT ^= USBMASK;
|
||||
|
||||
_delay_ms(25);
|
||||
|
||||
USBOUT ^= USBMASK;
|
||||
USBDDR = ddr_orig;
|
||||
USBOUT &= ~(1 << USBMINUS);
|
||||
|
||||
sei();
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
bool suspended = false;
|
||||
#if USB_COUNT_SOF
|
||||
@@ -115,6 +133,8 @@ int main(void) {
|
||||
raw_hid_task();
|
||||
}
|
||||
#endif
|
||||
} else if (suspend_wakeup_condition()) {
|
||||
usb_remote_wakeup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user