diff options
Diffstat (limited to 'tmk_core/common/keyboard.c')
-rw-r--r-- | tmk_core/common/keyboard.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index 200b1e8722..714c3d048f 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -89,6 +89,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifdef VIA_ENABLE # include "via.h" #endif +#ifdef DIP_SWITCH_ENABLE +# include "dip_switch.h" +#endif // Only enable this if console is enabled to print to #if defined(DEBUG_MATRIX_SCAN_RATE) && defined(CONSOLE_ENABLE) @@ -216,6 +219,13 @@ void keyboard_setup(void) { */ __attribute__((weak)) bool is_keyboard_master(void) { return true; } +/** \brief should_process_keypress + * + * Override this function if you have a condition where keypresses processing should change: + * - splits where the slave side needs to process for rgb/oled functionality + */ +__attribute__((weak)) bool should_process_keypress(void) { return is_keyboard_master(); } + /** \brief keyboard_init * * FIXME: needs doc @@ -268,6 +278,10 @@ void keyboard_init(void) { keymap_config.nkro = 1; eeconfig_update_keymap(keymap_config.raw); #endif +#ifdef DIP_SWITCH_ENABLE + dip_switch_init(); +#endif + keyboard_post_init_kb(); /* Always keep this last */ } @@ -298,7 +312,7 @@ void keyboard_task(void) { matrix_scan(); #endif - if (is_keyboard_master()) { + if (should_process_keypress()) { for (uint8_t r = 0; r < MATRIX_ROWS; r++) { matrix_row = matrix_get_row(r); matrix_change = matrix_row ^ matrix_prev[r]; |