summaryrefslogtreecommitdiff
path: root/quantum/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/main.c')
-rw-r--r--quantum/main.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/quantum/main.c b/quantum/main.c
index 2cbcd73d8f..6ed6b95741 100644
--- a/quantum/main.c
+++ b/quantum/main.c
@@ -19,8 +19,33 @@
void platform_setup(void);
void protocol_setup(void);
-void protocol_init(void);
-void protocol_task(void);
+void protocol_pre_init(void);
+void protocol_post_init(void);
+void protocol_pre_task(void);
+void protocol_post_task(void);
+
+// Bodge as refactoring this area sucks....
+void protocol_init(void) __attribute__((weak));
+void protocol_init(void) {
+ protocol_pre_init();
+
+ keyboard_init();
+
+ protocol_post_init();
+}
+
+void protocol_task(void) __attribute__((weak));
+void protocol_task(void) {
+ protocol_pre_task();
+
+ keyboard_task();
+
+ protocol_post_task();
+}
+
+#ifdef DEFERRED_EXEC_ENABLE
+void deferred_exec_task(void);
+#endif // DEFERRED_EXEC_ENABLE
/** \brief Main
*
@@ -30,12 +55,19 @@ int main(void) __attribute__((weak));
int main(void) {
platform_setup();
protocol_setup();
+ keyboard_setup();
protocol_init();
/* Main loop */
while (true) {
protocol_task();
+
+#ifdef DEFERRED_EXEC_ENABLE
+ // Run deferred executions
+ deferred_exec_task();
+#endif // DEFERRED_EXEC_ENABLE
+
housekeeping_task();
}
}