feat: implement bt/2.4ghz fr800x driver#26207
Conversation
wires QK_BLUETOOTH_PROFILE_* and QK_BLUETOOTH_UNPAIR. extends connection_config_t with 4-bit bluetooth_profile sharing the existing byte. existing values decode unchanged. new bluetooth.h api: get_max_profile, set_profile, get_profile, unpair. new connection.h api: set/get/next/prev_bluetooth_profile and two weak hooks. weak defaults keep rn42 and bluefruit_le single-profile. docs are updated. Signed-off-by: Roman Kuzmitskii <roman@damex.org>
1306492 to
266b5bb
Compare
266b5bb to
173c6bd
Compare
|
also noticed that it needs reconnection mechanic. implemented it on disconnection. otherwise if keyboard drop connection for whatever reason (signal drop, dongle plugged out or whatever else) there is no way to get back unless you switch profiles. it was like this: right now is much more user friendly: made changes, squashed and repushed those back. |
d8a287d to
94ca850
Compare
drashna
left a comment
There was a problem hiding this comment.
A lot of this looks like it's using a separate path for bt and wireless. I'm not sure that's the correct path for this. Eg, it should be a unified framework that doesn't care which it is using.
There was a problem hiding this comment.
new keycodes shouldn't be added to existing files. A new version should be added.
fr8003a is one chip each transport file holds only its own protocol bytes plus the framework wrappers that forward to the common driver Want me to collapse both into a single drivers/fr800x.{c,h} or we're good with such split? |
drivers/wireless/wireless_2p4ghz.{c,h}: dispatcher with 12 weak hooks
(init, task, is_connected, can_send_nkro, keyboard_leds, send_keyboard/
nkro/mouse/consumer/system/raw_hid, unpair).
new wireless_2p4ghz_driver host_driver_t in tmk_core/protocol/host.c.
host dispatch routes to it on CONNECTION_HOST_2P4GHZ. connection
auto-detect resolves via wireless_2p4ghz_is_connected. init/task
called from quantum/keyboard.c.
new QK_2P4GHZ_UNPAIR keycode (alias WL_UNPR) wired in
process_connection.c.
opt in via WIRELESS_2P4GHZ_ENABLE + WIRELESS_2P4GHZ_DRIVER. default off.
docs, json schema, info_rules mapping, via metadata, and 12 weak-default
unit tests under quantum/connection/tests/ included.
depends on the bluetooth multi-profile pull request to be merged first
since it touch the same files process_connection.c, keycodes.h, schema
info_rules, and docs merge after that pr lands.
Signed-off-by: Roman Kuzmitskii <roman@damex.org>
94ca850 to
df80479
Compare
drivers/fr800x.{c,h}: shared core for the freqchip fr8003a uart chip.
state machine, opcode framing, queue, 6kro/nkro projection, chip init
sequence (HANDSHAKE + SLEEP_BLUETOOTH_ENABLE + SLEEP_DONGLE_ENABLE),
target switching (3 BT slots + dongle), battery query, charging-state
relay.
reconnect lifecycle: 2 s retry while DISCONNECTED re-issues target +
HANDSHAKE (timer reset by every target_change to avoid race); per-target
PAIRING-to-DISCONNECTED timeout and per-target HANDSHAKE link probe
registered by adapters via fr800x_target_set_pairing_timeout and
fr800x_target_set_probe_interval. On a dead link the chip emits 0x33
which fires the existing reconnect path.
boot order: boards must call fr800x_chip_init before any slot select
(typically before connection_host_changed_kb in keyboard_post_init_kb).
Without that order the chip's RF monitoring stays half-configured and
silent radio losses go undetected.
weak fr800x_receive_connection_cb and fr800x_receive_host_cb expose
chip state and host suspend/resume to boards.
drivers/bluetooth/fr800x.c and drivers/wireless/fr800x.c: thin adapters
routing each driver's send/profile/unpair/leds/is_connected to the
core. wireless adapter pushes dongle manufacturer/product/vid+pid
descriptors on every DONGLE select (chip's 2.4G stack needs them to
fully initialize RF monitoring) and registers 5 s pairing timeout +
5 s link probe for DONGLE. bluetooth adapter registers 30 s pairing
timeout for BT slots 1-3 (no probe; chip's BLE link supervision handles
loss). fr800x_init is idempotent so dual-enable links cleanly.
builddefs/common_features.mk: register fr800x in BLUETOOTH and
WIRELESS_2P4GHZ driver-type lists; both set FR800X_DRIVER_REQUIRED and
require UART_FRAME.
data/schemas/keyboard.jsonschema: add fr800x to both driver enums.
docs: features/wireless.md, drivers/wireless_2p4ghz.md, config_options.md,
and reference_info_json.md list fr800x as a driver option.
soc-side uart protocol reverse-engineered from traffic sniffed with a
miniware la104 on a freqchip fr8003a.
depends on the bluetooth multi-profile and 2.4ghz wireless api PRs to
land first.
Signed-off-by: Roman Kuzmitskii <roman@damex.org>
df80479 to
fd2ba5e
Compare
Description
drivers/fr800x.{c,h}: shared core for the freqchip fr8003a uart chip.
state machine, opcode framing, queue, 6kro/nkro projection, chip init
sequence (HANDSHAKE + SLEEP_BLUETOOTH_ENABLE + SLEEP_DONGLE_ENABLE),
target switching (3 BT slots + dongle), battery query, charging-state
relay.
reconnect lifecycle: 2 s retry while DISCONNECTED re-issues target +
HANDSHAKE (timer reset by every target_change to avoid race); per-target
PAIRING-to-DISCONNECTED timeout and per-target HANDSHAKE link probe
registered by adapters via fr800x_target_set_pairing_timeout and
fr800x_target_set_probe_interval. On a dead link the chip emits 0x33
which fires the existing reconnect path.
boot order: boards must call fr800x_chip_init before any slot select
(typically before connection_host_changed_kb in keyboard_post_init_kb).
Without that order the chip's RF monitoring stays half-configured and
silent radio losses go undetected.
weak fr800x_receive_connection_cb and fr800x_receive_host_cb expose
chip state and host suspend/resume to boards.
drivers/bluetooth/fr800x.c and drivers/wireless/fr800x.c: thin adapters
routing each driver's send/profile/unpair/leds/is_connected to the
core. wireless adapter pushes dongle manufacturer/product/vid+pid
descriptors on every DONGLE select (chip's 2.4G stack needs them to
fully initialize RF monitoring) and registers 5 s pairing timeout +
5 s link probe for DONGLE. bluetooth adapter registers 30 s pairing
timeout for BT slots 1-3 (no probe; chip's BLE link supervision handles
loss). fr800x_init is idempotent so dual-enable links cleanly.
builddefs/common_features.mk: register fr800x in BLUETOOTH and
WIRELESS_2P4GHZ driver-type lists; both set FR800X_DRIVER_REQUIRED and
require UART_FRAME.
data/schemas/keyboard.jsonschema: add fr800x to both driver enums.
docs: features/wireless.md, drivers/wireless_2p4ghz.md, config_options.md,
and reference_info_json.md list fr800x as a driver option.
soc-side uart protocol reverse-engineered from traffic sniffed with a
miniware la104 on a freqchip fr8003a.
depends on the bluetooth multi-profile and 2.4ghz wireless api PRs to
land first.
Types of Changes
Issues Fixed or Closed by This PR
Checklist