2021-08-18 00:11:07 +01:00
|
|
|
/* Copyright 2021 QMK
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "keyboard.h"
|
|
|
|
|
|
|
|
void platform_setup(void);
|
|
|
|
|
|
|
|
void protocol_setup(void);
|
2021-11-02 18:53:46 +00:00
|
|
|
void protocol_pre_init(void);
|
|
|
|
void protocol_post_init(void);
|
2021-10-24 20:39:41 +01:00
|
|
|
void protocol_pre_task(void);
|
|
|
|
void protocol_post_task(void);
|
|
|
|
|
2021-11-02 18:53:46 +00:00
|
|
|
// Bodge as refactoring this area sucks....
|
2024-03-14 10:45:12 +00:00
|
|
|
void protocol_keyboard_task(void) __attribute__((weak));
|
|
|
|
void protocol_keyboard_task(void) {
|
2021-10-24 20:39:41 +01:00
|
|
|
keyboard_task();
|
|
|
|
}
|
2021-08-18 00:11:07 +01:00
|
|
|
|
|
|
|
/** \brief Main
|
|
|
|
*
|
|
|
|
* FIXME: Needs doc
|
|
|
|
*/
|
|
|
|
int main(void) __attribute__((weak));
|
|
|
|
int main(void) {
|
|
|
|
platform_setup();
|
|
|
|
protocol_setup();
|
2021-10-24 20:39:41 +01:00
|
|
|
keyboard_setup();
|
2021-08-18 00:11:07 +01:00
|
|
|
|
2024-03-14 10:45:12 +00:00
|
|
|
protocol_pre_init();
|
|
|
|
keyboard_init();
|
|
|
|
protocol_post_init();
|
2021-08-18 00:11:07 +01:00
|
|
|
|
|
|
|
/* Main loop */
|
|
|
|
while (true) {
|
2024-03-14 10:45:12 +00:00
|
|
|
protocol_pre_task();
|
|
|
|
protocol_keyboard_task();
|
|
|
|
protocol_post_task();
|
|
|
|
|
|
|
|
#ifdef RAW_ENABLE
|
|
|
|
void raw_hid_task(void);
|
|
|
|
raw_hid_task();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONSOLE_ENABLE
|
|
|
|
void console_task(void);
|
|
|
|
console_task();
|
|
|
|
#endif
|
2021-11-16 05:21:09 +11:00
|
|
|
|
2022-04-13 18:00:18 +10:00
|
|
|
#ifdef QUANTUM_PAINTER_ENABLE
|
2022-12-12 14:51:14 -06:00
|
|
|
// Run Quantum Painter task
|
|
|
|
void qp_internal_task(void);
|
|
|
|
qp_internal_task();
|
2022-04-13 18:00:18 +10:00
|
|
|
#endif
|
|
|
|
|
2021-11-16 05:21:09 +11:00
|
|
|
#ifdef DEFERRED_EXEC_ENABLE
|
|
|
|
// Run deferred executions
|
2022-04-13 18:00:18 +10:00
|
|
|
void deferred_exec_task(void);
|
2021-11-16 05:21:09 +11:00
|
|
|
deferred_exec_task();
|
2022-02-12 10:29:31 -08:00
|
|
|
#endif // DEFERRED_EXEC_ENABLE
|
2021-11-16 05:21:09 +11:00
|
|
|
|
2021-08-18 00:11:07 +01:00
|
|
|
housekeeping_task();
|
|
|
|
}
|
|
|
|
}
|