Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530)

This commit is contained in:
Nick Brassel 2020-10-23 15:58:16 +11:00 committed by James Young
parent de4cbe34ff
commit c4ecae1d77
No known key found for this signature in database
GPG key ID: 8E1085BF6FCFBD74
7 changed files with 44 additions and 0 deletions

View file

@ -229,6 +229,20 @@ __attribute__((weak)) bool is_keyboard_master(void) { return true; }
*/
__attribute__((weak)) bool should_process_keypress(void) { return is_keyboard_master(); }
/** \brief housekeeping_task_kb
*
* Override this function if you have a need to execute code for every keyboard main loop iteration.
* This is specific to keyboard-level functionality.
*/
__attribute__((weak)) void housekeeping_task_kb(void) {}
/** \brief housekeeping_task_user
*
* Override this function if you have a need to execute code for every keyboard main loop iteration.
* This is specific to user/keymap-level functionality.
*/
__attribute__((weak)) void housekeeping_task_user(void) {}
/** \brief keyboard_init
*
* FIXME: needs doc
@ -309,6 +323,9 @@ void keyboard_task(void) {
uint8_t keys_processed = 0;
#endif
housekeeping_task_kb();
housekeeping_task_user();
#if defined(OLED_DRIVER_ENABLE) && !defined(OLED_DISABLE_TIMEOUT)
uint8_t ret = matrix_scan();
#else