Commit c8054e44 authored by schneider's avatar schneider
Browse files

change(mp-ble): Use synchronous interface

Our interrupts are already scheduled via `mp_schedule()`. By switching
to the synchronous interface we avoid yet another `mp_schedule()` call
in the bluetooth module. This also allows the bluetooth module to not
have to use its internal ring buffer.
parent cd98e490
......@@ -99,6 +99,8 @@ static void handle_att_event(struct epic_att_event *att_event)
uint16_t end_handle =
(v[i + 3] << 8) | v[i + 2];
mp_obj_bluetooth_uuid_t service_uuid;
service_uuid.base.type =
&mp_type_bluetooth_uuid;
if (entry_size == 6) {
memcpy(service_uuid.data, v + i + 4, 2);
service_uuid.type =
......@@ -142,6 +144,8 @@ static void handle_att_event(struct epic_att_event *att_event)
uint16_t value_handle =
(v[i + 4] << 8) | v[i + 3];
mp_obj_bluetooth_uuid_t characteristic_uuid;
characteristic_uuid.base.type =
&mp_type_bluetooth_uuid;
if (entry_size == 2 + 1 + 2 + 2) {
memcpy(characteristic_uuid.data,
v + i + 5,
......@@ -189,6 +193,8 @@ static void handle_att_event(struct epic_att_event *att_event)
uint16_t descriptor_handle =
(v[i + 1] << 8) | v[i];
mp_obj_bluetooth_uuid_t descriptor_uuid;
descriptor_uuid.base.type =
&mp_type_bluetooth_uuid;
if (entry_size == 2 + 2) {
memcpy(descriptor_uuid.data,
v + i + 2,
......
......@@ -56,6 +56,7 @@ int mp_hal_csprng_read_int(void);
#define MICROPY_PY_BLUETOOTH (1)
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
#define MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE (1)
#define MICROPY_PY_BLUETOOTH_USE_SYNC_EVENTS (1)
/* Modules */
#define MODULE_BHI160_ENABLED (1)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment