Merge pull request #406 from 39aldo39/patch-1
authortmk <tmk@users.noreply.github.com>
Tue, 29 Nov 2016 13:53:31 +0000 (22:53 +0900)
committerGitHub <noreply@github.com>
Tue, 29 Nov 2016 13:53:31 +0000 (22:53 +0900)
core: Fix typo in definition AC_g

orphan/phantom/keymap.c
orphan/phantom/keymap_iso.h
tmk_core/protocol/vusb/main.c

index a040434f2478113b6c242f7b35c7708d2247b4cf..81180aa53a9ad708923aa84e33df6abb0ffaaebc 100644 (file)
@@ -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;
 }
index 80e507318c27cb55444ec159de2940ff6bdf46c7..af92e25eb2c8581f77abaf8836fc0c7d787a7d31 100644 (file)
@@ -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)
 };
index 0d809536d3514471cfd1fa3e5e88d95ce3c3c260..794e4000eaddd446eddeae8644f8f986b30ccf7f 100644 (file)
@@ -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();
         }
     }
 }
Imprint / Impressum