diff options
author | Joel Challis <git@zvecr.com> | 2021-10-24 20:39:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-24 20:39:41 +0100 |
commit | 2ec268bd21c6bb8d6afbd4908fb0289b0d1c6bd2 (patch) | |
tree | 48614655e9276d59038359339ebb33e8623b3a38 /tmk_core | |
parent | c3c562cbb698347f76977a9176d281594e8c77a3 (diff) | |
download | qmk_firmware-2ec268bd21c6bb8d6afbd4908fb0289b0d1c6bd2.tar.gz qmk_firmware-2ec268bd21c6bb8d6afbd4908fb0289b0d1c6bd2.zip |
Begin to carve out platform/protocol API - Migrate keyboard_* calls (#14888)
Diffstat (limited to 'tmk_core')
-rw-r--r-- | tmk_core/protocol/chibios/chibios.c | 15 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 19 | ||||
-rw-r--r-- | tmk_core/protocol/vusb/protocol.c | 7 |
3 files changed, 7 insertions, 34 deletions
diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c index c860328c8..98b330508 100644 --- a/tmk_core/protocol/chibios/chibios.c +++ b/tmk_core/protocol/chibios/chibios.c | |||
@@ -138,8 +138,6 @@ void protocol_setup(void) { | |||
138 | 138 | ||
139 | // TESTING | 139 | // TESTING |
140 | // chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); | 140 | // chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); |
141 | |||
142 | keyboard_setup(); | ||
143 | } | 141 | } |
144 | 142 | ||
145 | void protocol_init(void) { | 143 | void protocol_init(void) { |
@@ -176,18 +174,10 @@ void protocol_init(void) { | |||
176 | 174 | ||
177 | print("USB configured.\n"); | 175 | print("USB configured.\n"); |
178 | 176 | ||
179 | /* init TMK modules */ | ||
180 | keyboard_init(); | ||
181 | host_set_driver(driver); | 177 | host_set_driver(driver); |
182 | |||
183 | #ifdef SLEEP_LED_ENABLE | ||
184 | sleep_led_init(); | ||
185 | #endif | ||
186 | |||
187 | print("Keyboard start.\n"); | ||
188 | } | 178 | } |
189 | 179 | ||
190 | void protocol_task(void) { | 180 | void protocol_pre_task(void) { |
191 | usb_event_queue_task(); | 181 | usb_event_queue_task(); |
192 | 182 | ||
193 | #if !defined(NO_USB_STARTUP_CHECK) | 183 | #if !defined(NO_USB_STARTUP_CHECK) |
@@ -210,8 +200,9 @@ void protocol_task(void) { | |||
210 | # endif /* MOUSEKEY_ENABLE */ | 200 | # endif /* MOUSEKEY_ENABLE */ |
211 | } | 201 | } |
212 | #endif | 202 | #endif |
203 | } | ||
213 | 204 | ||
214 | keyboard_task(); | 205 | void protocol_post_task(void) { |
215 | #ifdef CONSOLE_ENABLE | 206 | #ifdef CONSOLE_ENABLE |
216 | console_task(); | 207 | console_task(); |
217 | #endif | 208 | #endif |
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 753762358..80781d2f3 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c | |||
@@ -1070,7 +1070,6 @@ void protocol_setup(void) { | |||
1070 | 1070 | ||
1071 | setup_mcu(); | 1071 | setup_mcu(); |
1072 | usb_device_state_init(); | 1072 | usb_device_state_init(); |
1073 | keyboard_setup(); | ||
1074 | } | 1073 | } |
1075 | 1074 | ||
1076 | void protocol_init(void) { | 1075 | void protocol_init(void) { |
@@ -1095,21 +1094,11 @@ void protocol_init(void) { | |||
1095 | #else | 1094 | #else |
1096 | USB_USBTask(); | 1095 | USB_USBTask(); |
1097 | #endif | 1096 | #endif |
1098 | /* init modules */ | ||
1099 | keyboard_init(); | ||
1100 | host_set_driver(&lufa_driver); | ||
1101 | #ifdef SLEEP_LED_ENABLE | ||
1102 | sleep_led_init(); | ||
1103 | #endif | ||
1104 | 1097 | ||
1105 | #ifdef VIRTSER_ENABLE | 1098 | host_set_driver(&lufa_driver); |
1106 | virtser_init(); | ||
1107 | #endif | ||
1108 | |||
1109 | print("Keyboard start.\n"); | ||
1110 | } | 1099 | } |
1111 | 1100 | ||
1112 | void protocol_task(void) { | 1101 | void protocol_pre_task(void) { |
1113 | #if !defined(NO_USB_STARTUP_CHECK) | 1102 | #if !defined(NO_USB_STARTUP_CHECK) |
1114 | if (USB_DeviceState == DEVICE_STATE_Suspended) { | 1103 | if (USB_DeviceState == DEVICE_STATE_Suspended) { |
1115 | print("[s]"); | 1104 | print("[s]"); |
@@ -1133,9 +1122,9 @@ void protocol_task(void) { | |||
1133 | suspend_wakeup_init(); | 1122 | suspend_wakeup_init(); |
1134 | } | 1123 | } |
1135 | #endif | 1124 | #endif |
1125 | } | ||
1136 | 1126 | ||
1137 | keyboard_task(); | 1127 | void protocol_post_task(void) { |
1138 | |||
1139 | #ifdef MIDI_ENABLE | 1128 | #ifdef MIDI_ENABLE |
1140 | MIDI_Device_USBTask(&USB_MIDI_Interface); | 1129 | MIDI_Device_USBTask(&USB_MIDI_Interface); |
1141 | #endif | 1130 | #endif |
diff --git a/tmk_core/protocol/vusb/protocol.c b/tmk_core/protocol/vusb/protocol.c index 89dc795b2..947c3383f 100644 --- a/tmk_core/protocol/vusb/protocol.c +++ b/tmk_core/protocol/vusb/protocol.c | |||
@@ -111,22 +111,15 @@ void protocol_setup(void) { | |||
111 | // clock prescaler | 111 | // clock prescaler |
112 | clock_prescale_set(clock_div_1); | 112 | clock_prescale_set(clock_div_1); |
113 | #endif | 113 | #endif |
114 | keyboard_setup(); | ||
115 | } | 114 | } |
116 | 115 | ||
117 | void protocol_init(void) { | 116 | void protocol_init(void) { |
118 | setup_usb(); | 117 | setup_usb(); |
119 | sei(); | 118 | sei(); |
120 | 119 | ||
121 | keyboard_init(); | ||
122 | |||
123 | host_set_driver(vusb_driver()); | 120 | host_set_driver(vusb_driver()); |
124 | 121 | ||
125 | wait_ms(50); | 122 | wait_ms(50); |
126 | |||
127 | #ifdef SLEEP_LED_ENABLE | ||
128 | sleep_led_init(); | ||
129 | #endif | ||
130 | } | 123 | } |
131 | 124 | ||
132 | void protocol_task(void) { | 125 | void protocol_task(void) { |