Commit Graph

94 Commits

Author SHA1 Message Date
Scott Shawcroft
f8290e746b
Don't blink blue on non-BLE workflow boards
This includes any boards that have _bleio implemented via HCI.

Fixes #4969
2021-07-19 18:40:37 -07:00
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
3940878695
Shrink builds and handle 0-length writes 2021-07-01 12:49:11 -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
Scott Shawcroft
42ee48ccb5
Improve error for invalid parameters 2021-05-19 14:09:11 -07:00
Scott Shawcroft
ee7a701487
Switch to start_advertising arg 2021-05-19 12:21:48 -07:00
gabewillen
e29158483e
Update Adapter.h
Added the tx_power to the adapter object
2021-05-19 11:56:49 -07:00
gabewillen
6b39df406a
Update Adapter.c
Added support for setting transmitter power currently done during every time advertising starts as implemented in the Arduino library
2021-05-19 11:55:47 -07:00
Jeff Epler
1a52cbcf5d Format a straggler file 2021-04-30 16:42:25 -05:00
Scott Shawcroft
17fcd499b2
Merge pull request #4649 from tannewt/merge_1.11_2
Merge MicroPython v1.11 into CircuitPython
2021-04-27 11:02:02 -07:00
Scott Shawcroft
76033d5115
Merge MicroPython v1.11 into CircuitPython 2021-04-26 15:47:41 -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
Scott Shawcroft
43c16c89c4
Account for max_packet_size in outgoing length 2021-04-15 16:34:06 -07:00
Scott Shawcroft
aa28d4f315
Allow setting max_packet_size for PacketBuffer
This is handy for remote characteristics because it allows for
the PacketBuffer binding code to have the correct max size. This
PR also adds checks so we don't write outside the outgoing buffer.
2021-04-14 17:09:48 -07:00
Scott Shawcroft
b273f59c4e
Assume max characteristic size when the client 2021-04-13 15:37:47 -07:00
Dan Halbert
72055ff02b
Merge pull request #4578 from tannewt/packetbuffer_lengths
Improve PacketBuffer lengths and remove packet_size
2021-04-08 18:55:24 -04:00
Scott Shawcroft
e3b3f97fa6
Improve PacketBuffer packet lengths for remote service 2021-04-08 13:25:11 -07:00
Jonny Bergdahl
1afd204828 Changed error message to display the generic term 'system firmware' instead of the Nordic specific term 'soft device' 2021-04-02 20:34:37 +02:00
Scott Shawcroft
58835e5a5b
Two small PacketBuffer fixes
1. Allow for ctrl-c during a write.
2. Handle disconnects when acting as a client.
2021-04-01 14:16:35 -07:00
Scott Shawcroft
0752bbd5fd
Fix central pairing and crash on clear
The list_clear would crash if we tried to clear a NULL list. (It
can happen if we haven't tried to discover any services.)
2021-03-31 16:04:04 -07:00
microDev
a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Dan Halbert
ccace62ac9 don't check length for remote characteristic or dedescriptor 2021-01-13 15:35:51 -05:00
Dan Halbert
a397af9bdf Round BLE timing values; fix timeout check 2021-01-10 13:16:19 -05:00
Dan Halbert
a11ad25727 BLE fixes 2020-12-23 16:39:27 -05:00
Scott Shawcroft
9fcf96cb64
Replace _bleio.ConnectionError with the native version
Replace uses of _bleio.ConnectionError with regular ConnectionError

Fixes #3008
2020-10-07 17:11:32 -07:00
Jeff Epler
b3bdd4686b PacketBuffer: add missing 'break's, remove unneeded {} 2020-09-13 15:10:38 -05:00
Dan Halbert
6dbd369272 merge from upstream 2020-08-30 14:39:03 -04:00
Scott Shawcroft
644d2ba7a2 Add more "extern" declarations for gcc10 compat
gcc has tightened the restrictions on forward declarations that lack
"extern".  Fix them up.
2020-08-21 14:39:37 -05:00
Dan Halbert
0e30dd8bcc merge from upstream; working; includes debug_out code for debugging via Saleae for posterity 2020-08-20 20:29:57 -04:00
Dan Halbert
94ecf33a5c
Merge pull request #3281 from dhalbert/fix-spim3-buffer-location
SPIM3 buffer must be in first 64kB of RAM
2020-08-17 19:28:03 -04:00
Scott Shawcroft
377503e61c
Merge pull request #3284 from dhalbert/fix-3171-evt-handler
Remove event handler before setting it to NULL
2020-08-17 15:02:29 -07:00
Dan Halbert
ef40f83f99 Remove event handler before setting it to NULL 2020-08-15 14:39:53 -04:00
Dan Halbert
cf0f3d70b5 SPIM3 buffer must be in first 64kB of RAM 2020-08-15 10:31:56 -04:00
Yihui Xiong
52990a332d fix 2020-08-14 17:48:15 +08:00
Yihui Xiong
e7da652711 able to change ble mac address 2020-08-13 16:54:29 +08:00
Dan Halbert
44c9c43cd1 ble_uart_echo_test works 2020-08-13 00:03:39 -04:00
Dan Halbert
06f3b4048a fix #3228 for nrf; still needs to be fixed for HCI; tested 2020-08-11 16:21:16 -04:00
Dan Halbert
0f4b969d62 discovery of Nordic UART service working 2020-08-08 00:29:37 -04:00
Dan Halbert
0a60aee3e4 wip: compiles 2020-08-02 11:36:38 -04:00
Dan Halbert
6494bbdc64 snapshot 2020-07-16 23:14:49 -04:00
Dan Halbert
f6869c69c5 wip: advertising; not tested 2020-07-12 19:45:23 -04:00
Sean Cross
c1bcc25b88 nrf: _bleio: clean up timeout calculation
The timeout value is calculated by the common-hal layer now, so we don't
need to be quite so clever about calculating it here.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-19 21:56:39 +08:00
Sean Cross
34f91f01c6 bleio: adapter: add advertising timeout and status
Add a field to allow specifying a timeout when initiating advertising.
As part of this, add a new property to determine if the device is still
advertising.

Additionally, have the `anonymous` property require a timeout, and set
the timeout to the maximum possible value if no timeout is specified.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-19 15:01:19 +08:00
Sean Cross
cfe65742a3 _bleio: support anonymous advertising
Add a new parameter to the `start_advertising()` function to enable
anonymous advertising.  This forces a call to `sd_ble_gap_privacy_set()`
with `privacy_mode` set to `BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY` and
`private_addr_type` set to
`BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_RESOLVABLE`.

With this, addresses will cycle at a predefined rate (currently once
every 15 minutes).

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-19 15:01:18 +08:00
Dan Halbert
b7836aeac6 address review comments 2020-05-04 19:51:08 -04:00
Dan Halbert
bae7a5e433 make translate again 2020-05-04 17:26:59 -04:00
Dan Halbert
d6c6f9f4f0 add PacketBuffer .incoming_ and .outgoing_packet_length 2020-05-04 15:59:45 -04:00
Dan Halbert
f3078511a6 further cleanup and bug fixing 2020-04-29 23:18:08 -04:00