run bt things on ready callback

This commit is contained in:
Korneliusz Osmenda
2022-08-22 17:41:41 +02:00
parent b376a8e508
commit 3268072965
2 changed files with 6 additions and 8 deletions
-5
View File
@@ -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;
}
+6 -3
View File
@@ -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(&reg_data.mut);