-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BLE support to BluetoothHIDMaster (#2208)
Support Bluetooth BLE keyboard and mice using the same HID master infrastructure as the BT Classic.
- Loading branch information
1 parent
c104c67
commit bde21e5
Showing
10 changed files
with
740 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
libraries/BluetoothHCI/examples/BluetoothBLEScanner/BluetoothBLEScanner.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <BluetoothHCI.h> | ||
|
||
BluetoothHCI hci; | ||
|
||
void BTBasicSetup() { | ||
l2cap_init(); | ||
gatt_client_init(); | ||
sm_init(); | ||
sm_set_io_capabilities(IO_CAPABILITY_NO_INPUT_NO_OUTPUT); | ||
gap_set_default_link_policy_settings(LM_LINK_POLICY_ENABLE_SNIFF_MODE | LM_LINK_POLICY_ENABLE_ROLE_SWITCH); | ||
hci_set_master_slave_policy(HCI_ROLE_MASTER); | ||
hci_set_inquiry_mode(INQUIRY_MODE_RSSI_AND_EIR); | ||
|
||
hci.setBLEName("Pico BLE Scanner"); | ||
hci.install(); | ||
hci.begin(); | ||
} | ||
|
||
void setup() { | ||
delay(5000); | ||
BTBasicSetup(); | ||
} | ||
|
||
void loop() { | ||
Serial.printf("BEGIN BLE SCAN @%lu ...", millis()); | ||
auto l = hci.scanBLE(BluetoothHCI::any_cod); | ||
Serial.printf("END BLE SCAN @%lu\n\n", millis()); | ||
Serial.printf("%-8s | %-17s | %-4s | %s\n", "Class", "Address", "RSSI", "Name"); | ||
Serial.printf("%-8s | %-17s | %-4s | %s\n", "--------", "-----------------", "----", "----------------"); | ||
for (auto e : l) { | ||
Serial.printf("%08lx | %17s | %4d | %s\n", e.deviceClass(), e.addressString(), e.rssi(), e.name()); | ||
} | ||
Serial.printf("\n\n\n"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.