2021-08-18 07:11:07 +08: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-03 02:53:46 +08:00
|
|
|
void protocol_pre_init(void);
|
|
|
|
void protocol_post_init(void);
|
2021-10-25 03:39:41 +08:00
|
|
|
void protocol_pre_task(void);
|
|
|
|
void protocol_post_task(void);
|
|
|
|
|
2021-11-03 02:53:46 +08:00
|
|
|
// Bodge as refactoring this area sucks....
|
2024-03-14 18:45:12 +08:00
|
|
|
void protocol_keyboard_task(void) __attribute__((weak));
|
|
|
|
void protocol_keyboard_task(void) {
|
2021-10-25 03:39:41 +08:00
|
|
|
keyboard_task();
|
|
|
|
}
|
2021-08-18 07:11:07 +08:00
|
|
|
|
|
|
|
/** \brief Main
|
|
|
|
*
|
|
|
|
* FIXME: Needs doc
|
|
|
|
*/
|
|
|
|
int main(void) __attribute__((weak));
|
|
|
|
int main(void) {
|
|
|
|
platform_setup();
|
|
|
|
protocol_setup();
|
2021-10-25 03:39:41 +08:00
|
|
|
keyboard_setup();
|
2021-08-18 07:11:07 +08:00
|
|
|
|
2024-03-14 18:45:12 +08:00
|
|
|
protocol_pre_init();
|
|
|
|
keyboard_init();
|
|
|
|
protocol_post_init();
|
2021-08-18 07:11:07 +08:00
|
|
|
|
|
|
|
/* Main loop */
|
|
|
|
while (true) {
|
2024-03-14 18:45:12 +08: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 02:21:09 +08:00
|
|
|
|
2022-04-13 16:00:18 +08:00
|
|
|
#ifdef QUANTUM_PAINTER_ENABLE
|
2022-12-13 04:51:14 +08:00
|
|
|
// Run Quantum Painter task
|
|
|
|
void qp_internal_task(void);
|
|
|
|
qp_internal_task();
|
2022-04-13 16:00:18 +08:00
|
|
|
#endif
|
|
|
|
|
2021-11-16 02:21:09 +08:00
|
|
|
#ifdef DEFERRED_EXEC_ENABLE
|
|
|
|
// Run deferred executions
|
2022-04-13 16:00:18 +08:00
|
|
|
void deferred_exec_task(void);
|
2021-11-16 02:21:09 +08:00
|
|
|
deferred_exec_task();
|
2022-02-13 02:29:31 +08:00
|
|
|
#endif // DEFERRED_EXEC_ENABLE
|
2021-11-16 02:21:09 +08:00
|
|
|
|
2021-08-18 07:11:07 +08:00
|
|
|
housekeeping_task();
|
|
|
|
}
|
|
|
|
}
|