summaryrefslogtreecommitdiff
path: root/ports/nrf/bluetooth
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-12-28 22:55:29 -0500
committerDan Halbert <halbert@halwitz.org>2018-12-28 23:34:23 -0500
commit4d1f0ec07be5e9cacaf0072a0f987871b8505ec4 (patch)
tree2cb328eb77d8c9732ecd24580b33869fa8a3c505 /ports/nrf/bluetooth
parent4167bf5b241eec4e5a04c36d7f7c66d43a8bb921 (diff)
Add Broadcaster. Reset correctly on reload.
Diffstat (limited to 'ports/nrf/bluetooth')
-rw-r--r--ports/nrf/bluetooth/ble_drv.c7
-rw-r--r--ports/nrf/bluetooth/ble_drv.h3
2 files changed, 9 insertions, 1 deletions
diff --git a/ports/nrf/bluetooth/ble_drv.c b/ports/nrf/bluetooth/ble_drv.c
index 0b6daf711..41d51cfb4 100644
--- a/ports/nrf/bluetooth/ble_drv.c
+++ b/ports/nrf/bluetooth/ble_drv.c
@@ -45,7 +45,12 @@ typedef struct event_handler {
ble_drv_evt_handler_t func;
} event_handler_t;
-static event_handler_t *m_event_handlers;
+static event_handler_t *m_event_handlers = NULL;
+
+void ble_drv_reset() {
+ // Linked-list members will be gc'd.
+ m_event_handlers = NULL;
+}
void ble_drv_add_event_handler(ble_drv_evt_handler_t func, void *param) {
event_handler_t *handler = m_new_ll(event_handler_t, 1);
diff --git a/ports/nrf/bluetooth/ble_drv.h b/ports/nrf/bluetooth/ble_drv.h
index 0443b41b8..696aff1da 100644
--- a/ports/nrf/bluetooth/ble_drv.h
+++ b/ports/nrf/bluetooth/ble_drv.h
@@ -43,11 +43,14 @@
#define BLE_CONN_CFG_TAG_CUSTOM 1
#define MSEC_TO_UNITS(TIME, RESOLUTION) (((TIME) * 1000) / (RESOLUTION))
+// 0.625 msecs (625 usecs)
+#define ADV_INTERVAL_UNIT_FLOAT_SECS (0.000625)
#define UNIT_0_625_MS (625)
#define UNIT_10_MS (10000)
typedef void (*ble_drv_evt_handler_t)(ble_evt_t*, void*);
+void ble_drv_reset();
void ble_drv_add_event_handler(ble_drv_evt_handler_t func, void *param);
#endif // MICROPY_INCLUDED_NRF_BLUETOOTH_BLE_DRV_H