Commit 866d5133 authored by schneider's avatar schneider
Browse files

change(ble): Introduce epic_ble_(de)init

parent ce5d890c
......@@ -147,6 +147,18 @@ int epic_ble_is_connection_open(void)
return AppConnIsOpen();
}
int epic_ble_init(void)
{
epic_interrupt_enable(EPIC_INT_BLE);
return 0;
}
int epic_ble_deinit(void)
{
epic_interrupt_disable(EPIC_INT_BLE);
return 0;
}
int epic_ble_set_device_name(const uint8_t *buf, uint16_t len)
{
return epic_ble_atts_set_attr(GAP_DN_HDL, buf, len);
......
......@@ -189,6 +189,9 @@ typedef _Bool bool;
#define API_BLE_ATTC_WRITE_NO_RSP 0x18B
#define API_BLE_ATTC_WRITE 0x18C
#define API_BLE_INIT 0x190
#define API_BLE_DEINIT 0x191
/* clang-format on */
typedef uint32_t api_int_id_t;
......@@ -2658,6 +2661,8 @@ API(API_BLE_HID_SEND_REPORT, int epic_ble_hid_send_report(uint8_t report_id, uin
*
* The MicroPython Bluetooth module is still in flux so this API will continue to change as well.
*/
API(API_BLE_INIT, int epic_ble_init(void));
API(API_BLE_DEINIT, int epic_ble_deinit(void));
API(API_BLE_ATTS_DYN_CREATE_GROUP, int epic_atts_dyn_create_service(const uint8_t *uuid, uint8_t uuid_len, uint16_t group_size, void **pSvcHandle));
//API(API_BLE_ATTS_DYN_DELETE_GROUP, void AttsDynDeleteGroup(void *pSvcHandle));
API(API_BLE_ATTS_DYN_DELETE_GROUPS, int epic_ble_atts_dyn_delete_groups(void));
......
......@@ -438,7 +438,7 @@ int mp_bluetooth_init(void)
MP_ROM_INT(EPIC_INT_BLE), (mp_obj_t *)&ble_event_obj
);
clear_events();
epic_interrupt_enable(EPIC_INT_BLE);
epic_ble_init();
active = true;
return 0;
}
......@@ -446,7 +446,7 @@ int mp_bluetooth_init(void)
// Disables the Bluetooth stack. Is a no-op when not enabled.
void mp_bluetooth_deinit(void)
{
epic_interrupt_disable(EPIC_INT_BLE);
epic_ble_deinit();
active = false;
}
......
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