Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a mechanism for split keyboards to process key press on both halves #9001

Merged
merged 1 commit into from
May 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tmk_core/common/keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,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
Expand Down Expand Up @@ -292,7 +299,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];
Expand Down