diff options
Diffstat (limited to 'tmk_core')
| -rw-r--r-- | tmk_core/common/keyboard.c | 11 | ||||
| -rw-r--r-- | tmk_core/protocol/chibios/main.c | 30 |
2 files changed, 36 insertions, 5 deletions
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 81df8eb73..3a1262a9f 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c | |||
| @@ -49,6 +49,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 49 | #ifdef RGBLIGHT_ENABLE | 49 | #ifdef RGBLIGHT_ENABLE |
| 50 | # include "rgblight.h" | 50 | # include "rgblight.h" |
| 51 | #endif | 51 | #endif |
| 52 | #ifdef SERIAL_LINK_ENABLE | ||
| 53 | # include "serial_link/system/serial_link.h" | ||
| 54 | #endif | ||
| 52 | 55 | ||
| 53 | #ifdef MATRIX_HAS_GHOST | 56 | #ifdef MATRIX_HAS_GHOST |
| 54 | static bool has_ghost_in_row(uint8_t row) | 57 | static bool has_ghost_in_row(uint8_t row) |
| @@ -167,11 +170,15 @@ MATRIX_LOOP_END: | |||
| 167 | #endif | 170 | #endif |
| 168 | 171 | ||
| 169 | #ifdef SERIAL_MOUSE_ENABLE | 172 | #ifdef SERIAL_MOUSE_ENABLE |
| 170 | serial_mouse_task(); | 173 | serial_mouse_task(); |
| 171 | #endif | 174 | #endif |
| 172 | 175 | ||
| 173 | #ifdef ADB_MOUSE_ENABLE | 176 | #ifdef ADB_MOUSE_ENABLE |
| 174 | adb_mouse_task(); | 177 | adb_mouse_task(); |
| 178 | #endif | ||
| 179 | |||
| 180 | #ifdef SERIAL_LINK_ENABLE | ||
| 181 | serial_link_update(); | ||
| 175 | #endif | 182 | #endif |
| 176 | 183 | ||
| 177 | // update LED | 184 | // update LED |
diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index 54bb6a8f5..aeb11752f 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c | |||
| @@ -35,6 +35,9 @@ | |||
| 35 | #ifdef SLEEP_LED_ENABLE | 35 | #ifdef SLEEP_LED_ENABLE |
| 36 | #include "sleep_led.h" | 36 | #include "sleep_led.h" |
| 37 | #endif | 37 | #endif |
| 38 | #ifdef SERIAL_LINK_ENABLE | ||
| 39 | #include "serial_link/system/serial_link.h" | ||
| 40 | #endif | ||
| 38 | #include "suspend.h" | 41 | #include "suspend.h" |
| 39 | 42 | ||
| 40 | 43 | ||
| @@ -98,9 +101,27 @@ int main(void) { | |||
| 98 | /* init printf */ | 101 | /* init printf */ |
| 99 | init_printf(NULL,sendchar_pf); | 102 | init_printf(NULL,sendchar_pf); |
| 100 | 103 | ||
| 101 | /* Wait until the USB is active */ | 104 | #ifdef SERIAL_LINK_ENABLE |
| 102 | while(USB_DRIVER.state != USB_ACTIVE) | 105 | init_serial_link(); |
| 106 | #endif | ||
| 107 | |||
| 108 | host_driver_t* driver = NULL; | ||
| 109 | |||
| 110 | /* Wait until the USB or serial link is active */ | ||
| 111 | while (true) { | ||
| 112 | if(USB_DRIVER.state == USB_ACTIVE) { | ||
| 113 | driver = &chibios_driver; | ||
| 114 | break; | ||
| 115 | } | ||
| 116 | #ifdef SERIAL_LINK_ENABLE | ||
| 117 | if(is_serial_link_connected()) { | ||
| 118 | driver = get_serial_link_driver(); | ||
| 119 | break; | ||
| 120 | } | ||
| 121 | serial_link_update(); | ||
| 122 | #endif | ||
| 103 | chThdSleepMilliseconds(50); | 123 | chThdSleepMilliseconds(50); |
| 124 | } | ||
| 104 | 125 | ||
| 105 | /* Do need to wait here! | 126 | /* Do need to wait here! |
| 106 | * Otherwise the next print might start a transfer on console EP | 127 | * Otherwise the next print might start a transfer on console EP |
| @@ -113,7 +134,7 @@ int main(void) { | |||
| 113 | 134 | ||
| 114 | /* init TMK modules */ | 135 | /* init TMK modules */ |
| 115 | keyboard_init(); | 136 | keyboard_init(); |
| 116 | host_set_driver(&chibios_driver); | 137 | host_set_driver(driver); |
| 117 | 138 | ||
| 118 | #ifdef SLEEP_LED_ENABLE | 139 | #ifdef SLEEP_LED_ENABLE |
| 119 | sleep_led_init(); | 140 | sleep_led_init(); |
| @@ -128,6 +149,9 @@ int main(void) { | |||
| 128 | print("[s]"); | 149 | print("[s]"); |
| 129 | while(USB_DRIVER.state == USB_SUSPENDED) { | 150 | while(USB_DRIVER.state == USB_SUSPENDED) { |
| 130 | /* Do this in the suspended state */ | 151 | /* Do this in the suspended state */ |
| 152 | #ifdef SERIAL_LINK_ENABLE | ||
| 153 | serial_link_update(); | ||
| 154 | #endif | ||
| 131 | suspend_power_down(); // on AVR this deep sleeps for 15ms | 155 | suspend_power_down(); // on AVR this deep sleeps for 15ms |
| 132 | /* Remote wakeup */ | 156 | /* Remote wakeup */ |
| 133 | if((USB_DRIVER.status & 2) && suspend_wakeup_condition()) { | 157 | if((USB_DRIVER.status & 2) && suspend_wakeup_condition()) { |
