extmod/modbluetooth: Allow MP_BLUETOOTH_MAX_ATTR_SIZE in board config.

pull/1/head
Andrew Leech 2019-09-02 15:40:31 +10:00 committed by Jim Mussared
parent 5dc592d117
commit eb1b6858a2
2 changed files with 7 additions and 0 deletions

View File

@ -48,7 +48,9 @@
#endif
// Common constants.
#ifndef MP_BLUETOOTH_MAX_ATTR_SIZE
#define MP_BLUETOOTH_MAX_ATTR_SIZE (20)
#endif
// Advertisement packet lengths
#define MP_BLUETOOTH_GAP_ADV_MAX_LEN (32)

View File

@ -301,6 +301,11 @@ STATIC void sync_cb(void) {
assert(rc == 0);
}
if (MP_BLUETOOTH_MAX_ATTR_SIZE > 20) {
rc = ble_att_set_preferred_mtu(MP_BLUETOOTH_MAX_ATTR_SIZE+3);
assert(rc == 0);
}
ble_svc_gap_device_name_set(MICROPY_PY_BLUETOOTH_DEFAULT_NAME);
ble_state = BLE_STATE_ACTIVE;