Wireless/Bluetooth
[ble]
To enable BLE, add enabled = true under the [ble] section.
There are several more configs for reading battery level and charging state; they are currently available for nRF52 (SAADC) chips.
Some legacy BLE adapters cannot connect to devices using 2M PHY at all. For those hosts, enable the use_1m_phy Cargo feature of the rmk crate, which makes the keyboard use 1M PHY for the host connection.
This only affects host connections. The dongle link and the split link between the halves always run at 2M PHY, so a keyboard built with both dongle and use_1m_phy keeps those links fast and still connects to a legacy adapter on its other BLE profiles.
Passkey entry
RMK supports typing a BLE passkey directly on the keyboard during pairing. This is disabled by default, and requires the passkey_entry Cargo feature of the rmk crate in addition to the configuration below.
During passkey mode, the keyboard intercepts all keypresses. Only the following keys are recognized:
All other keys are silently discarded while passkey mode is active.
Split battery ADC configuration
For split keyboards, you can configure battery ADC separately for the central and each peripheral:
Notes:
- If
[split.central]provides battery ADC settings, they override the top-level[ble]battery settings for the central. - Peripherals do not fall back to
[ble]; to enable peripheral battery reporting, set ADC values per peripheral.
Peripheral battery reporting over BLE GATT
When peripherals are configured to sample their batteries (see above), their levels are forwarded to the central over the split BLE links and re-exposed to the host through standard Battery Service instances (UUID 0x180F) on the central's GATT server. The host sees one Battery Service instance for:
- the central's own battery level, and
- each
[[split.peripheral]]that definesbattery_adc_pin.
Each peripheral's Battery Service uses its peripheral ID to set the description field in the Characteristic Presentation Format descriptor. Peripheral IDs 0, 1, and 2 use the Bluetooth SIG ordinal values first, second, and third, respectively. No host-side configuration is required; any host that already reads the central's Battery Level characteristic can discover the additional instances the same way.
Battery Level characteristics also expose a Characteristic User Description descriptor. The defaults are Central for the central and Peripheral 0, Peripheral 1, and so on for peripherals. Set battery_user_description under [ble], [split.central], or an individual [[split.peripheral]] to provide a custom name. [split.central].battery_user_description overrides [ble].battery_user_description for the central.
The split feature uses trouble-host's default client ATT table size. To reserve more space for client-specific attributes such as CCCDs, set TROUBLE_HOST_CLIENT_ATT_TABLE_SIZE in the project environment, for example in .cargo/config.toml:
This project-wide override takes precedence over trouble-host Cargo feature settings and can be set to the size required by the enabled services.