aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/protocol/chibios/main.c
diff options
context:
space:
mode:
authorAlex Ong <the.onga@gmail.com>2019-01-04 19:43:45 +1100
committerAlex Ong <the.onga@gmail.com>2019-01-04 19:43:45 +1100
commit2bb2977c133646c4e056960e72029270d77cc1eb (patch)
tree235d491f992121ac1716c5bf2fafb80983748576 /tmk_core/protocol/chibios/main.c
parenta55c838961c89097ab849ed6cb1f261791e6b9b4 (diff)
parent47c91fc7f75ae0a477e55b687aa0fc30da0a283c (diff)
downloadqmk_firmware-2bb2977c133646c4e056960e72029270d77cc1eb.tar.gz
qmk_firmware-2bb2977c133646c4e056960e72029270d77cc1eb.zip
Merge branch 'master' into debounce_refactor
# Conflicts: # tmk_core/common/keyboard.c
Diffstat (limited to 'tmk_core/protocol/chibios/main.c')
-rw-r--r--tmk_core/protocol/chibios/main.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c
index f2abc438d..ee9571c95 100644
--- a/tmk_core/protocol/chibios/main.c
+++ b/tmk_core/protocol/chibios/main.c
@@ -44,6 +44,9 @@
44#ifdef MIDI_ENABLE 44#ifdef MIDI_ENABLE
45#include "qmk_midi.h" 45#include "qmk_midi.h"
46#endif 46#endif
47#ifdef STM32_EEPROM_ENABLE
48#include "eeprom_stm32.h"
49#endif
47#include "suspend.h" 50#include "suspend.h"
48#include "wait.h" 51#include "wait.h"
49 52
@@ -72,7 +75,7 @@ host_driver_t chibios_driver = {
72void virtser_task(void); 75void virtser_task(void);
73#endif 76#endif
74 77
75#ifdef RAW_HID_ENABLE 78#ifdef RAW_ENABLE
76void raw_hid_task(void); 79void raw_hid_task(void);
77#endif 80#endif
78 81
@@ -109,6 +112,10 @@ int main(void) {
109 halInit(); 112 halInit();
110 chSysInit(); 113 chSysInit();
111 114
115#ifdef STM32_EEPROM_ENABLE
116 EEPROM_init();
117#endif
118
112 // TESTING 119 // TESTING
113 // chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); 120 // chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
114 121
@@ -135,10 +142,15 @@ int main(void) {
135 142
136 /* Wait until the USB or serial link is active */ 143 /* Wait until the USB or serial link is active */
137 while (true) { 144 while (true) {
145#if defined(WAIT_FOR_USB) || defined(SERIAL_LINK_ENABLE)
138 if(USB_DRIVER.state == USB_ACTIVE) { 146 if(USB_DRIVER.state == USB_ACTIVE) {
139 driver = &chibios_driver; 147 driver = &chibios_driver;
140 break; 148 break;
141 } 149 }
150#else
151 driver = &chibios_driver;
152 break;
153#endif
142#ifdef SERIAL_LINK_ENABLE 154#ifdef SERIAL_LINK_ENABLE
143 if(is_serial_link_connected()) { 155 if(is_serial_link_connected()) {
144 driver = get_serial_link_driver(); 156 driver = get_serial_link_driver();
@@ -171,6 +183,7 @@ int main(void) {
171 /* Main loop */ 183 /* Main loop */
172 while(true) { 184 while(true) {
173 185
186#if !defined(NO_USB_STARTUP_CHECK)
174 if(USB_DRIVER.state == USB_SUSPENDED) { 187 if(USB_DRIVER.state == USB_SUSPENDED) {
175 print("[s]"); 188 print("[s]");
176#ifdef VISUALIZER_ENABLE 189#ifdef VISUALIZER_ENABLE
@@ -198,6 +211,7 @@ int main(void) {
198 visualizer_resume(); 211 visualizer_resume();
199#endif 212#endif
200 } 213 }
214#endif
201 215
202 keyboard_task(); 216 keyboard_task();
203#ifdef CONSOLE_ENABLE 217#ifdef CONSOLE_ENABLE
@@ -206,7 +220,7 @@ int main(void) {
206#ifdef VIRTSER_ENABLE 220#ifdef VIRTSER_ENABLE
207 virtser_task(); 221 virtser_task();
208#endif 222#endif
209#ifdef RAW_HID_ENABLE 223#ifdef RAW_ENABLE
210 raw_hid_task(); 224 raw_hid_task();
211#endif 225#endif
212 } 226 }