You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Extensible split data sync capability through transactions.
- Split common transport has been split up between the transport layer
and data layer.
- Split "transactions" model used, with convergence between I2C and
serial data definitions.
- Slave matrix "generation count" is used to determine if the full slave
matrix needs to be retrieved.
- Encoders get the same "generation count" treatment.
- All other blocks of data are synchronised when a change is detected.
- All transmissions have a globally-configurable deadline before a
transmission is forced (`FORCED_SYNC_THROTTLE_MS`, default 100ms).
- Added atomicity for all core-synced data, preventing partial updates
- Added retries to AVR i2c_master's i2c_start, to minimise the number of
failed transactions when interrupts are disabled on the slave due to
atomicity checks.
- Some keyboards have had slight modifications made in order to ensure
that they still build due to firmware size restrictions.
* Fixup LED_MATRIX compile.
* Parameterise ERROR_DISCONNECT_COUNT.
Copy file name to clipboardExpand all lines: docs/config_options.md
+24-2Lines changed: 24 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -284,7 +284,7 @@ There are a few different ways to set handedness for split keyboards (listed in
284
284
### Other Options
285
285
286
286
*`#define USE_I2C`
287
-
* For using I2C instead of Serial (defaults to serial)
287
+
* For using I2C instead of Serial (default is serial; serial transport is supported on ARM -- I2C is AVR-only)
288
288
289
289
*`#define SOFT_SERIAL_PIN D0`
290
290
* When using serial, define this. `D0` or `D1`,`D2`,`D3`,`E6`.
@@ -312,14 +312,36 @@ There are a few different ways to set handedness for split keyboards (listed in
312
312
*`#define SPLIT_USB_DETECT`
313
313
* Detect (with timeout) USB connection when delegating master/slave
314
314
* Default behavior for ARM
315
-
* Required for AVR Teensy
315
+
* Required for AVR Teensy (without hardware mods)
316
316
317
317
*`#define SPLIT_USB_TIMEOUT 2000`
318
318
* Maximum timeout when detecting master/slave when using `SPLIT_USB_DETECT`
319
319
320
320
*`#define SPLIT_USB_TIMEOUT_POLL 10`
321
321
* Poll frequency when detecting master/slave when using `SPLIT_USB_DETECT`
322
322
323
+
*`#define FORCED_SYNC_THROTTLE_MS 100`
324
+
* Deadline for synchronizing data from master to slave when using the QMK-provided split transport.
325
+
326
+
*`#define SPLIT_TRANSPORT_MIRROR`
327
+
* Mirrors the master-side matrix on the slave when using the QMK-provided split transport.
328
+
329
+
*`#define SPLIT_LAYER_STATE_ENABLE`
330
+
* Ensures the current layer state is available on the slave when using the QMK-provided split transport.
331
+
332
+
*`#define SPLIT_LED_STATE_ENABLE`
333
+
* Ensures the current host indicator state (caps/num/scroll) is available on the slave when using the QMK-provided split transport.
334
+
335
+
*`#define SPLIT_MODS_ENABLE`
336
+
* Ensures the current modifier state (normal, weak, and oneshot) is available on the slave when using the QMK-provided split transport.
337
+
338
+
*`#define SPLIT_WPM_ENABLE`
339
+
* Ensures the current WPM is available on the slave when using the QMK-provided split transport.
340
+
341
+
*`#define SPLIT_TRANSACTION_IDS_KB .....`
342
+
*`#define SPLIT_TRANSACTION_IDS_USER .....`
343
+
* Allows for custom data sync with the slave when using the QMK-provided split transport. See [custom data sync between sides](feature_split_keyboard.md#custom-data-sync) for more information.
344
+
323
345
# The `rules.mk` File
324
346
325
347
This is a [make](https://www.gnu.org/software/make/manual/make.html) file that is included by the top-level `Makefile`. It is used to set some information about the MCU that we will be compiling for as well as enabling and disabling certain features.
@@ -8,8 +8,7 @@ QMK Firmware has a generic implementation that is usable by any board, as well a
8
8
9
9
For this, we will mostly be talking about the generic implementation used by the Let's Split and other keyboards.
10
10
11
-
!> ARM is not yet fully supported for Split Keyboards and has many limitations. Progress is being made, but we have not yet reached 100% feature parity.
12
-
11
+
!> ARM split supports most QMK subsystems when using the 'serial' and 'serial_usart' drivers. I2C slave is currently unsupported.
13
12
14
13
## Compatibility Overview
15
14
@@ -168,7 +167,7 @@ Because not every split keyboard is identical, there are a number of additional
168
167
#defineUSE_I2C
169
168
```
170
169
171
-
This enables I<sup>2</sup>C support for split keyboards. This isn't strictly for communication, but can be used for OLED or other I<sup>2</sup>C-based devices.
170
+
This configures the use of I<sup>2</sup>C support for split keyboard transport (AVR only).
172
171
173
172
```c
174
173
#defineSOFT_SERIAL_PIN D0
@@ -192,20 +191,115 @@ If you're having issues with serial communication, you can change this value, as
192
191
* **`5`**: about 20kbps
193
192
194
193
```c
195
-
#define SPLIT_MODS_ENABLE
194
+
#define FORCED_SYNC_THROTTLE_MS 100
196
195
```
197
196
198
-
This enables transmitting modifier state (normal, weak and oneshot) to the non
199
-
primary side of the split keyboard. This adds a few bytes of data to the split
200
-
communication protocol and may impact the matrix scan speed when enabled.
201
-
The purpose of this feature is to support cosmetic use of modifer state (e.g.
202
-
displaying status on an OLED screen).
197
+
This sets the maximum number of milliseconds before forcing a synchronization of data from master to slave. Under normal circumstances this sync occurs whenever the data _changes_, for safety a data transfer occurs after this number of milliseconds if no change has been detected since the last sync.
203
198
204
199
```c
205
200
#define SPLIT_TRANSPORT_MIRROR
206
201
```
207
202
208
-
This mirrors the master side matrix to the slave side for features that react or require knowledge of master side key presses on the slave side. This adds a few bytes of data to the split communication protocol and may impact the matrix scan speed when enabled. The purpose of this feature is to support cosmetic use of key events (e.g. RGB reacting to Keypresses).
203
+
This mirrors the master side matrix to the slave side for features that react or require knowledge of master side key presses on the slave side. The purpose of this feature is to support cosmetic use of key events (e.g. RGB reacting to keypresses). This adds overhead to the split communication protocol and may negatively impact the matrix scan speed when enabled.
204
+
205
+
```c
206
+
#define SPLIT_LAYER_STATE_ENABLE
207
+
```
208
+
209
+
This enables syncing of the layer state between both halves of the split keyboard. The main purpose of this feature is to enable support for use of things like OLED display of the currently active layer. This adds overhead to the split communication protocol and may negatively impact the matrix scan speed when enabled.
210
+
211
+
```c
212
+
#define SPLIT_LED_STATE_ENABLE
213
+
```
214
+
215
+
This enables syncing of the Host LED status (caps lock, num lock, etc) between both halves of the split keyboard. The main purpose of this feature is to enable support for use of things like OLED display of the Host LED status. This adds overhead to the split communication protocol and may negatively impact the matrix scan speed when enabled.
216
+
217
+
```c
218
+
#define SPLIT_MODS_ENABLE
219
+
```
220
+
221
+
This enables transmitting modifier state (normal, weak and oneshot) to the non primary side of the split keyboard. The purpose of this feature is to support cosmetic use of modifer state (e.g. displaying status on an OLED screen). This adds overhead to the split communication protocol and may negatively impact the matrix scan speed when enabled.
222
+
223
+
```c
224
+
#define SPLIT_WPM_ENABLE
225
+
```
226
+
227
+
This enables transmitting the current WPM to the slave side of the split keyboard. The purpose of this feature is to support cosmetic use of WPM (e.g. displaying the current value on an OLED screen). This adds overhead to the split communication protocol and may negatively impact the matrix scan speed when enabled.
228
+
229
+
### Custom data sync between sides :id=custom-data-sync
230
+
231
+
QMK's split transport allows for arbitrary data transactions at both the keyboard and user levels. This is modelled on a remote procedure call, with the master invoking a function on the slave side, with the ability to send data from master to slave, process it slave side, and send data back from slave to master.
232
+
233
+
To leverage this, a keyboard or user/keymap can define a comma-separated list of _transaction IDs_:
The master side can then invoke the slave-side handler - for normal keyboard functionality to be minimally affected, any keyboard- or user-level code attempting to sync data should be throttled:
dprintf("Slave value: %d\n", s2m.s2m_data); // this will now be 11, as the slave adds 5
277
+
} else {
278
+
dprint("Slave sync failed!\n");
279
+
}
280
+
}
281
+
}
282
+
}
283
+
```
284
+
285
+
!> It is recommended that any data sync between halves happens during the master side's _housekeeping task_. This ensures timely retries should failures occur.
286
+
287
+
If only one-way data transfer is needed, helper methods are provided:
// Retry i2c_start_impl a bunch times in case the remote side has interrupts disabled.
97
+
uint16_ttimeout_timer=timer_read();
98
+
uint16_ttime_slice=MAX(1, (timeout== (I2C_TIMEOUT_INFINITE)) ? 5 : (timeout / (I2C_START_RETRY_COUNT))); // if it's infinite, wait 1ms between attempts, otherwise split up the entire timeout into the number of retries
99
+
i2c_status_tstatus;
100
+
do {
101
+
status=i2c_start_impl(address, time_slice);
102
+
} while ((status<0) && ((timeout==I2C_TIMEOUT_INFINITE) || (timer_elapsed(timeout_timer) <timeout)));
0 commit comments