extmod/modbluetooth: Register default GATT service and fix esp32 init.
This is for the NimBLE bindings, to make sure the default GATT service appears and that the esp32 initialises NimBLE correctly (it now matches stm32).
This commit is contained in:
parent
a4c96fb3b0
commit
3705bc418c
@ -39,6 +39,7 @@
|
|||||||
#include "nimble/ble.h"
|
#include "nimble/ble.h"
|
||||||
#include "nimble/nimble_port.h"
|
#include "nimble/nimble_port.h"
|
||||||
#include "services/gap/ble_svc_gap.h"
|
#include "services/gap/ble_svc_gap.h"
|
||||||
|
#include "services/gatt/ble_svc_gatt.h"
|
||||||
|
|
||||||
#ifndef MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME
|
#ifndef MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME
|
||||||
#define MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME "MPY NIMBLE"
|
#define MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME "MPY NIMBLE"
|
||||||
@ -271,8 +272,9 @@ int mp_bluetooth_init(void) {
|
|||||||
nimble_port_init();
|
nimble_port_init();
|
||||||
mp_bluetooth_nimble_port_postinit();
|
mp_bluetooth_nimble_port_postinit();
|
||||||
|
|
||||||
// By default, just register the default gap service.
|
// By default, just register the default gap/gatt service.
|
||||||
ble_svc_gap_init();
|
ble_svc_gap_init();
|
||||||
|
ble_svc_gatt_init();
|
||||||
|
|
||||||
mp_bluetooth_nimble_port_start();
|
mp_bluetooth_nimble_port_start();
|
||||||
|
|
||||||
@ -466,8 +468,9 @@ int mp_bluetooth_gatts_register_service_begin(bool append) {
|
|||||||
// Reset the gatt characteristic value db.
|
// Reset the gatt characteristic value db.
|
||||||
mp_bluetooth_gatts_db_reset(MP_STATE_PORT(bluetooth_nimble_root_pointers)->gatts_db);
|
mp_bluetooth_gatts_db_reset(MP_STATE_PORT(bluetooth_nimble_root_pointers)->gatts_db);
|
||||||
|
|
||||||
// By default, just register the default gap service.
|
// By default, just register the default gap/gatt service.
|
||||||
ble_svc_gap_init();
|
ble_svc_gap_init();
|
||||||
|
ble_svc_gatt_init();
|
||||||
|
|
||||||
if (!append) {
|
if (!append) {
|
||||||
// Unref any previous service definitions.
|
// Unref any previous service definitions.
|
||||||
|
@ -44,7 +44,6 @@ void mp_bluetooth_nimble_port_preinit(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mp_bluetooth_nimble_port_postinit(void) {
|
void mp_bluetooth_nimble_port_postinit(void) {
|
||||||
nimble_port_freertos_init(ble_host_task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void mp_bluetooth_nimble_port_deinit(void) {
|
void mp_bluetooth_nimble_port_deinit(void) {
|
||||||
@ -52,6 +51,7 @@ void mp_bluetooth_nimble_port_deinit(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mp_bluetooth_nimble_port_start(void) {
|
void mp_bluetooth_nimble_port_start(void) {
|
||||||
|
nimble_port_freertos_init(ble_host_task);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user