From 32680729654f94b537fd4d290f01ef915602ed8e Mon Sep 17 00:00:00 2001 From: Korneliusz Osmenda Date: Mon, 22 Aug 2022 17:41:41 +0200 Subject: [PATCH] run bt things on ready callback --- src/bt.c | 5 ----- src/main.cpp | 9 ++++++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/bt.c b/src/bt.c index 9280eb2..27d7191 100644 --- a/src/bt.c +++ b/src/bt.c @@ -381,14 +381,9 @@ BT_CONN_CB_DEFINE(conn_callbacks) = { .disconnected = disconnected, }; -static struct bt_gatt_cb gatt_callbacks = { -}; void barrot_init() { - - bt_gatt_cb_register(&gatt_callbacks); - bt_le_scan_start(BT_LE_SCAN_ACTIVE, device_found); return; } diff --git a/src/main.cpp b/src/main.cpp index e20adf9..2c2ef1b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -53,6 +53,11 @@ int d_print(int c) return 1; } +void bt_enabled(int err) +{ + barrot_init(); +} + int main(void) { if(!tlay2.Init()) @@ -66,13 +71,11 @@ int main(void) if(err) return err; - err = bt_enable(NULL); + err = bt_enable(bt_enabled); if (err) { return 1; } - barrot_init(); - k_mutex_init(®_data.mut);