From: tmk Date: Tue, 29 Nov 2016 13:53:31 +0000 (+0900) Subject: Merge pull request #406 from 39aldo39/patch-1 X-Git-Url: https://git.gir.st/tmk_keyboard.git/commitdiff_plain/a6f725d2bc21979b364cb60207c973229a2a4550?hp=54a19346070531389c98c67e59cee1aaa13c36d5 Merge pull request #406 from 39aldo39/patch-1 core: Fix typo in definition AC_g --- diff --git a/orphan/phantom/keymap.c b/orphan/phantom/keymap.c index a040434f..81180aa5 100644 --- a/orphan/phantom/keymap.c +++ b/orphan/phantom/keymap.c @@ -145,7 +145,7 @@ action_t keymap_fn_to_action(uint8_t keycode) if (FN_INDEX(keycode) < FN_ACTIONS_SIZE) { action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]); } else { - action.code = ACTION_NO; + return (action_t)ACTION_NO; } return action; } diff --git a/orphan/phantom/keymap_iso.h b/orphan/phantom/keymap_iso.h index 80e50731..af92e25e 100644 --- a/orphan/phantom/keymap_iso.h +++ b/orphan/phantom/keymap_iso.h @@ -11,9 +11,9 @@ static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* 1: media keys */ KEYMAP_ISO(\ TRNS, TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,SLEP, \ - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MUTE,VOLD,VOLU, TRNS,TRNS,TRNS, \ - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MSTP,MPLY,MPRV,MNXT,MSEL, TRNS,TRNS,TRNS, \ - TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MUTE,VOLD,VOLU,TRNS, TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MSTP,MPLY,MPRV,MNXT, TRNS,TRNS,TRNS, \ + TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,MSEL, \ TRNS,TRNS,TRNS,TRNS,CALC,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS, CAPS, TRNS, \ TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS, TRNS,TRNS,TRNS) }; diff --git a/tmk_core/protocol/vusb/main.c b/tmk_core/protocol/vusb/main.c index 0d809536..794e4000 100644 --- a/tmk_core/protocol/vusb/main.c +++ b/tmk_core/protocol/vusb/main.c @@ -20,6 +20,7 @@ #include "timer.h" #include "uart.h" #include "debug.h" +#include "suspend.h" #define UART_BAUD_RATE 115200 @@ -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; @@ -70,19 +88,6 @@ int main(void) // Suspend when no SOF in 3ms-10ms(7.1.7.4 Suspending of USB1.1) if (timer_elapsed(last_timer) > 5) { suspended = true; -/* - uart_putchar('S'); - _delay_ms(1); - cli(); - set_sleep_mode(SLEEP_MODE_PWR_DOWN); - sleep_enable(); - sleep_bod_disable(); - sei(); - sleep_cpu(); - sleep_disable(); - _delay_ms(10); - uart_putchar('W'); -*/ } } #endif @@ -95,6 +100,8 @@ int main(void) keyboard_task(); } vusb_transfer_keyboard(); + } else if (suspend_wakeup_condition()) { + usb_remote_wakeup(); } } }