Add housekeeping task callbacks so that keyboards/keymaps are capable of executing code for each main loop iteration. (#10530)
This commit is contained in:
		
							parent
							
								
									de4cbe34ff
								
							
						
					
					
						commit
						c4ecae1d77
					
				
					 7 changed files with 44 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,6 +69,9 @@ void keyboard_pre_init_user(void);
 | 
			
		|||
void keyboard_post_init_kb(void);
 | 
			
		||||
void keyboard_post_init_user(void);
 | 
			
		||||
 | 
			
		||||
void housekeeping_task_kb(void);
 | 
			
		||||
void housekeeping_task_user(void);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue