bt-keyboard
bt-keyboard copied to clipboard
Adding compatibility with Arduino IDE and bonding/reconnect features
Hi! Sorry if I'm doing this wrong or if it's just a mess. I'm a noob on Git and in coding in general. I just want to bring awareness on the many improves I made to the code:
-added isConnected
flag, hidh_callback()
will update it in case of connections/disconnections.
-now devices_scan(
) returns true if a device of interest has been found and connection open requested for it (doesn't guarantee connection, refer to isConnected
for that)
-added BLE security params and enabled bonding/permanent key exchange.
-now handle_ble_device_result()
and devices_scan()
will retrieve the bonded devices list from flash and connect to the latest bonded device if in range, avoiding the need to enter pairing mode, otherwise discovery and pairing goes on as normal.
-added quick_reconnect()
function that can be recursively called if isConnected
flag goes false. This will try to reconnect to the latest device without losing time on scanning. This is critical for battery keyboards that go to sleep or reset.