Skip to content

Commit e77872f

Browse files
authored
Merge pull request adafruit#1491 from dhalbert/ble-data-length-update
bleio: handle events sent by newer devices and by Android
2 parents 49581f9 + 04aa906 commit e77872f

4 files changed

Lines changed: 14 additions & 1 deletion

File tree

docs/drivers.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ These libraries build on top of the low level APIs to simplify common tasks.
7070
miniQR Non-hardware QR code generator <https://circuitpython.readthedocs.io/projects/miniqr/en/latest/>
7171
Slideshow <https://circuitpython.readthedocs.io/projects/slideshow/en/latest/>
7272
LED Animation <https://circuitpython.readthedocs.io/projects/led-animation/en/latest/>
73+
Bluetooth Low Energy (BLE) <https://circuitpython.readthedocs.io/projects/ble/en/latest/>
74+
Bluefruit LE Connect App <https://circuitpython.readthedocs.io/projects/bluefruitconnect/en/latest/>
7375

7476
Blinky
7577
--------

ports/nrf/common-hal/bleio/Peripheral.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,19 @@ STATIC void peripheral_on_ble_evt(ble_evt_t *ble_evt, void *self_in) {
266266
break;
267267
}
268268

269+
case BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST:
270+
sd_ble_gap_data_length_update(self->conn_handle, NULL, NULL);
271+
break;
272+
269273
case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST: {
270274
sd_ble_gatts_exchange_mtu_reply(self->conn_handle, BLE_GATT_ATT_MTU_DEFAULT);
271275
break;
272276
}
273277

278+
case BLE_GATTS_EVT_SYS_ATTR_MISSING:
279+
sd_ble_gatts_sys_attr_set(self->conn_handle, NULL, 0, 0);
280+
break;
281+
274282
default:
275283
// For debugging.
276284
// mp_printf(&mp_plat_print, "Unhandled peripheral event: 0x%04x\n", ble_evt->header.evt_id);

shared-bindings/bleio/Device.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
//| :class:`Device` -- BLE device
4949
//| =========================================================
5050
//|
51+
//| **IGNORE ``Device`` and all its documentation.
52+
//| It is being replaced by `Peripheral` and other classes.**
53+
//|
5154
//| Provides access a to BLE device, either in a Peripheral or Central role.
5255
//| When a device is created without any parameter passed to the constructor,
5356
//| it will be set to the Peripheral role. If a address is passed, the device

shared-bindings/bleio/Peripheral.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static const char default_name[] = "CIRCUITPY";
7070
//| periph = bleio.Peripheral([service])
7171
//| periph.start_advertising()
7272
//|
73-
//| while not periph.connected():
73+
//| while not periph.connected:
7474
//| # Wait for connection.
7575
//| pass
7676
//|

0 commit comments

Comments
 (0)