Commit Graph

24 Commits

Author SHA1 Message Date
Scott Shawcroft 0fadf028ef
Create first BLE-only board, Micro:Bit v2
This fixes build issues with USB off, tweaks the README to allow
for BLE-only boards and adds the Micro:Bit v2 definition.

Fixes #4546
2021-07-14 09:55:51 -07:00
Scott Shawcroft f2ef586331
clean up 2021-06-29 11:54:15 -07:00
Scott Shawcroft 3177973843
Add BLE serial service 2021-06-25 15:00:10 -07:00
Scott Shawcroft dc76306cfa
Enable a BLE workflow
nRF CircuitPython boards will now provide the file transfer
service defined here: https://github.com/adafruit/Adafruit_CircuitPython_BLE_File_Transfer

USB capable boards will only advertise if previously bonded to a
device or if the reset button is pressed during the fast blue
flashes on start up. When pressed, the board will restart again but
the blue period will not flash.

Boards without USB will always advertise.

When previously bonded, the advertisement is private so that no
other peers can connect. If advertising publicly, the tx power is
lowered to reduce the likelihood of bonding from a distance.

This PR also fixes issues with loading identities of bonded peers
so that our address can now be resolved and we can resolve others'
addresses when scanning.
2021-06-24 12:59:14 -07:00
Artyom Skrobov 4e3c1d4a4c [build] Allow USB to be set to 0
Unify USB-related makefile var and C def as CIRCUITPY_USB.

Always define it as 0 or 1, same as all other settings.

USB_AVAILABLE was conditionally defined in supervisor.mk,
but never actually used to #ifdef USB-related code.

Loosely related to #4546
2021-04-23 11:13:34 -04:00
microDev a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Dan Halbert 759929c24a hci early wip; refactor supervisor bluetooth.c for nrf: tested 2020-06-25 20:57:17 -04:00
Dan Halbert 87f73e2729 track vm_used_ble better 2020-01-30 09:52:06 -05:00
Scott Shawcroft 82fb761c0f
Add PacketBuffer and MTU negotiation support.
PacketBuffer facilitates packet oriented BLE protocols such as BLE
MIDI and the Apple Media Service.

This also adds PHY, MTU and connection event extension negotiation
to speed up data transfer when possible.
2020-01-03 17:29:54 -08:00
Dan Halbert fd03fd5e4f sd_flash_operation_status should be volatile 2019-12-12 00:19:03 -05:00
Scott Shawcroft da0ea979ff
Check connection validity after service discovery.
Fixes #2347
2019-12-06 16:03:14 -08:00
Scott Shawcroft 17c8356b8c
Add connection interval and debugging
This also sets TinyUSB to master and to not include its submodules.

It also fixes an old displayio example comment and retries gattc
reads.
2019-12-04 14:39:02 -08:00
Scott Shawcroft ae30a1e5aa
Refine _bleio
This PR refines the _bleio API. It was originally motivated by
the addition of a new CircuitPython service that enables reading
and modifying files on the device. Moving the BLE lifecycle outside
of the VM motivated a number of changes to remove heap allocations
in some APIs.

It also motivated unifying connection initiation to the Adapter class
rather than the Central and Peripheral classes which have been removed.
Adapter now handles the GAP portion of BLE including advertising, which
has moved but is largely unchanged, and scanning, which has been enhanced
to return an iterator of filtered results.

Once a connection is created (either by us (aka Central) or a remote
device (aka Peripheral)) it is represented by a new Connection class.
This class knows the current connection state and can discover and
instantiate remote Services along with their Characteristics and
Descriptors.

Relates to #586
2019-10-21 18:57:03 -07:00
Dan Halbert a1b5d800f3 Update copyrights; get ready for Central 2019-06-19 10:42:36 -04:00
Dan Halbert 9cceea0d68 nrf: fix internal flash writes 2019-03-18 09:11:40 -04:00
Dan Halbert 99da3b9646 Use critical section, not lock, in CharacteristicBuffer; use a root pointer for ble_drv list 2019-02-21 00:19:31 -05:00
Dan Halbert a345ef28f2 finish Makefile refactoring; nrf builds work 2019-02-15 18:55:10 -05:00
hathach d1fb384a4a
update tinyusb, work better with sd 2019-01-29 21:03:18 +07:00
Dan Halbert f66f55b4ed add CharacteristicBuffer; UART seems to work! 2019-01-07 22:46:20 -05:00
Dan Halbert a77b2363ef evt handler list bugs; unique evt handler names; remove uuid128_reference 2019-01-03 21:42:42 -05:00
Dan Halbert 941ccf87c8 don't free event handler list manually; let gc do it 2018-12-31 09:02:43 -05:00
Dan Halbert ef39e72c7c free event handlers on reset; fix typo in Broadcaster 2018-12-29 13:55:10 -05:00
Dan Halbert 4d1f0ec07b Add Broadcaster. Reset correctly on reload. 2018-12-28 23:34:23 -05:00
arturo182 d5a71a4b8a nrf: Move bluetooth driver to the 'bluetooth' folder 2018-10-21 15:55:25 +02:00