Skip to content
Snippets Groups Projects
Commit 15f99475 authored by schneider's avatar schneider
Browse files

feat(mp-ble): Allow to check if module is initialized

parent fe64723f
No related branches found
No related tags found
1 merge request!446Initial MicroPython BLE support (GATTS)
...@@ -151,6 +151,8 @@ typedef struct { ...@@ -151,6 +151,8 @@ typedef struct {
enum notification_status notification_status; enum notification_status notification_status;
} gatts_status_entry_t; } gatts_status_entry_t;
static bool active = false;
static void gatts_status_create_entry(mp_gatts_db_t db, uint16_t handle) static void gatts_status_create_entry(mp_gatts_db_t db, uint16_t handle)
{ {
mp_map_elem_t *elem = mp_map_lookup( mp_map_elem_t *elem = mp_map_lookup(
...@@ -305,20 +307,21 @@ int mp_bluetooth_init(void) ...@@ -305,20 +307,21 @@ int mp_bluetooth_init(void)
); );
clear_events(); clear_events();
epic_interrupt_enable(EPIC_INT_BLE); epic_interrupt_enable(EPIC_INT_BLE);
active = true;
return 0; return 0;
} }
// Disables the Bluetooth stack. Is a no-op when not enabled. // Disables the Bluetooth stack. Is a no-op when not enabled.
void mp_bluetooth_deinit(void) void mp_bluetooth_deinit(void)
{ {
//raise();
epic_interrupt_disable(EPIC_INT_BLE); epic_interrupt_disable(EPIC_INT_BLE);
active = false;
} }
// Returns true when the Bluetooth stack is enabled. // Returns true when the Bluetooth stack is enabled.
bool mp_bluetooth_is_active(void) bool mp_bluetooth_is_active(void)
{ {
return true; return active;
} }
// Gets the MAC addr of this device in big-endian format. // Gets the MAC addr of this device in big-endian format.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment