diff options
| author | Joel Challis <git@zvecr.com> | 2024-03-14 10:45:12 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-14 21:45:12 +1100 |
| commit | 63dd131d812be4b8d4894fc20ca9968e25996b07 (patch) | |
| tree | b51902172408e9325aef625034cbf8f6a92e55e0 /quantum | |
| parent | 4bbfecae90e994b4a7d9bf5db06a995fb05d6ab2 (diff) | |
Refactor vusb to protocol use pre/post task (#14944)
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/main.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/quantum/main.c b/quantum/main.c index 3b101c522c..3159c55850 100644 --- a/quantum/main.c +++ b/quantum/main.c | |||
| @@ -25,22 +25,9 @@ void protocol_pre_task(void); | |||
| 25 | void protocol_post_task(void); | 25 | void protocol_post_task(void); |
| 26 | 26 | ||
| 27 | // Bodge as refactoring this area sucks.... | 27 | // Bodge as refactoring this area sucks.... |
| 28 | void protocol_init(void) __attribute__((weak)); | 28 | void protocol_keyboard_task(void) __attribute__((weak)); |
| 29 | void protocol_init(void) { | 29 | void protocol_keyboard_task(void) { |
| 30 | protocol_pre_init(); | ||
| 31 | |||
| 32 | keyboard_init(); | ||
| 33 | |||
| 34 | protocol_post_init(); | ||
| 35 | } | ||
| 36 | |||
| 37 | void protocol_task(void) __attribute__((weak)); | ||
| 38 | void protocol_task(void) { | ||
| 39 | protocol_pre_task(); | ||
| 40 | |||
| 41 | keyboard_task(); | 30 | keyboard_task(); |
| 42 | |||
| 43 | protocol_post_task(); | ||
| 44 | } | 31 | } |
| 45 | 32 | ||
| 46 | /** \brief Main | 33 | /** \brief Main |
| @@ -53,11 +40,25 @@ int main(void) { | |||
| 53 | protocol_setup(); | 40 | protocol_setup(); |
| 54 | keyboard_setup(); | 41 | keyboard_setup(); |
| 55 | 42 | ||
| 56 | protocol_init(); | 43 | protocol_pre_init(); |
| 44 | keyboard_init(); | ||
| 45 | protocol_post_init(); | ||
| 57 | 46 | ||
| 58 | /* Main loop */ | 47 | /* Main loop */ |
| 59 | while (true) { | 48 | while (true) { |
| 60 | protocol_task(); | 49 | protocol_pre_task(); |
| 50 | protocol_keyboard_task(); | ||
| 51 | protocol_post_task(); | ||
| 52 | |||
| 53 | #ifdef RAW_ENABLE | ||
| 54 | void raw_hid_task(void); | ||
| 55 | raw_hid_task(); | ||
| 56 | #endif | ||
| 57 | |||
| 58 | #ifdef CONSOLE_ENABLE | ||
| 59 | void console_task(void); | ||
| 60 | console_task(); | ||
| 61 | #endif | ||
| 61 | 62 | ||
| 62 | #ifdef QUANTUM_PAINTER_ENABLE | 63 | #ifdef QUANTUM_PAINTER_ENABLE |
| 63 | // Run Quantum Painter task | 64 | // Run Quantum Painter task |
