-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_bleio HCI implementation #3310
Conversation
…ia Saleae for posterity
Use this firmware (unzip first) to test: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are my comments wrt/shared-bindings only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few questions. Nothing major.
Tested ble_uart_echo_test on a metro_m4_airlift_lite with the NINA HCI BT.bin firmware -- works! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question here plus one on the library. Should this take native pins only? Is it prepared for a DigitalInOut-like class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question here plus one on the library. Should this take native pins only? Is it prepared for a DigitalInOut-like class?
I am taking DigitalInOut
s because the calling library already needs to use them to do the initial hard reset of the adapter. It's not prepared for a duck-type DigitalInOut
class, but I think we can code for that internally when we need to. I could imagine that there's an internal software HCI adapter that has rts
and cts
signals that are not actual pins, so I don't think it should take pins. I'm thinking about how displayio
takes abstractions rather than pins, for instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you!
woohoo |
Uses the same logic applied in 5b57ae9 to determine when to add .exe. See related: adafruit#3310, adafruit#3361, adafruit#3370, adafruit#4143, adafruit#5727.
Adds
_bleio
support for UART-based HCI adapters. Tested with ESP32 firmware on Metro M4 Airlift and with an ESP32 breakout. Firmware used is attached to this PR.This version supports operation as a peripheral only. Specifically it has been tested with
UARTService
, using the Bluefruit LE Connect app. Scanning, initiating a connection, access to remote characteristics, and bonding/pairing are not yet implemented. Code to be rewritten is commented out and mostly marked as//FIX
.The HCI and ATT protocol code here was derived from ArduinoBLE (our fork), and from include files from Zephyr BLE support. It was converted from C++ to C, and restructured in various ways. Ad hoc packet packing and unpacking was replaced with the use of structs from the Zephyr include files.
The ESP32 firmware used does not have extended advertising enabled. There is latent support for extended advertising in this PR, but it has not been tested.
The ESP32 needs initialization before use in BLE mode. That code is not here, but will be added in a shortly forthcoming PR to the https://github.com/adafruit/Adafruit_CircuitPython_BLE library.
Use this firmware (unzip first) to test:
NINA HCI BT.bin.zip
You will need adafruit/Adafruit_CircuitPython_BLE#103, or the latest version of
adafruit_ble
, after that PR is merged.Fixes #3228 (list inconsistency).
Fixes #1292 (use HCI).