Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows up to two Bluetooth host connections on Spike, which is needed for some upcoming applications. It also makes the existing support for simultaneous USB/BLE explicit. Until now, you'd have to connect BLE first, and then USB to make it work. Now you can do it in any order.
pbio/drv/bluetooth,usb: Add connection changed callback. Technically an independent cleanup. Services connection changes once instead of by polling.
pbio/sys/light: Change priority of USB light. Combining the green USB state with a blinking blue light is hard to see. Since advertising is a temporary state, keep this as blue/off/blue/off, even if there is already a host connected. The solid color returns when advertising is done. USB+BLE = Green+Blue = Cyan.
pbio/drv/bluetooth_btstack: Don't advertise if connected. Only start the operation when there are free connections left, or we're waiting forever.
pbio/sys/hmi: Support simultaneous USB and BLE host. Refactors the Powered Up HMI to take in the light update and connection callback introduced above.
pbio/drv/bluetooth: Split out connection checks. Minor cleanup as an existing connection platform hook became obsolete.
pbio/drv/bluetooth_btstack: Allow multiple hosts. This is the main change as far as actual driver code is concerned. It refactors the BTstack driver to not work with a singleton host handles, but
Nbluetooth hosts.Ongoing work:
We'll still want to protect new downloads being started while another is in progress. But that was already an issue before this PR since you could have USB and BLE connected at the same time. See pybricks/support#2551.