diff options
| author | Joel Challis <git@zvecr.com> | 2020-02-25 14:10:04 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-25 14:10:04 +0000 |
| commit | f6111d49bbfeb90fdb86c4595ba339590b364da7 (patch) | |
| tree | 7d6cae52cc4a7d850ab9104f8f92d65c1d39622d /quantum/split_common/split_util.c | |
| parent | 891d28a37954ada620fab3727499fe2e9ee3fe65 (diff) | |
| download | qmk_firmware-f6111d49bbfeb90fdb86c4595ba339590b364da7.tar.gz qmk_firmware-f6111d49bbfeb90fdb86c4595ba339590b364da7.zip | |
Split - Avoid race condition during matrix_init_quantum (#8235)
* Avoid race condition during matrix_init_quantum
* spelling is hard
Diffstat (limited to 'quantum/split_common/split_util.c')
| -rw-r--r-- | quantum/split_common/split_util.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c index 103bc9714..fb6a3b85a 100644 --- a/quantum/split_common/split_util.c +++ b/quantum/split_common/split_util.c | |||
| @@ -81,19 +81,8 @@ __attribute__((weak)) bool is_keyboard_master(void) { | |||
| 81 | return (usbstate == MASTER); | 81 | return (usbstate == MASTER); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | static void keyboard_master_setup(void) { | ||
| 85 | #if defined(USE_I2C) | ||
| 86 | # ifdef SSD1306OLED | ||
| 87 | matrix_master_OLED_init(); | ||
| 88 | # endif | ||
| 89 | #endif | ||
| 90 | transport_master_init(); | ||
| 91 | } | ||
| 92 | |||
| 93 | static void keyboard_slave_setup(void) { transport_slave_init(); } | ||
| 94 | |||
| 95 | // this code runs before the keyboard is fully initialized | 84 | // this code runs before the keyboard is fully initialized |
| 96 | void keyboard_split_setup(void) { | 85 | void split_pre_init(void) { |
| 97 | isLeftHand = is_keyboard_left(); | 86 | isLeftHand = is_keyboard_left(); |
| 98 | 87 | ||
| 99 | #if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) | 88 | #if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) |
| @@ -106,8 +95,18 @@ void keyboard_split_setup(void) { | |||
| 106 | #endif | 95 | #endif |
| 107 | 96 | ||
| 108 | if (is_keyboard_master()) { | 97 | if (is_keyboard_master()) { |
| 109 | keyboard_master_setup(); | 98 | #if defined(USE_I2C) && defined(SSD1306OLED) |
| 110 | } else { | 99 | matrix_master_OLED_init(); |
| 111 | keyboard_slave_setup(); | 100 | #endif |
| 101 | transport_master_init(); | ||
| 102 | } | ||
| 103 | } | ||
| 104 | |||
| 105 | // this code runs after the keyboard is fully initialized | ||
| 106 | // - avoids race condition during matrix_init_quantum where slave can start | ||
| 107 | // receiving before the init process has completed | ||
| 108 | void split_post_init(void) { | ||
| 109 | if (!is_keyboard_master()) { | ||
| 110 | transport_slave_init(); | ||
| 112 | } | 111 | } |
| 113 | } | 112 | } |
