Skip to content

Commit 3b3b01f

Browse files
maje-embnordicjm
authored andcommitted
samples: bluetooth: peripheral_uart: replace printk with logging API
This sample uses the UART interface to communicate with the NUS. Logging is handled using RTT. Signed-off-by: Marcin Jelinski <[email protected]>
1 parent e206767 commit 3b3b01f

File tree

1 file changed

+5
-5
lines changed
  • samples/bluetooth/peripheral_uart/src

1 file changed

+5
-5
lines changed

samples/bluetooth/peripheral_uart/src/main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,11 @@ static void adv_work_handler(struct k_work *work)
339339
int err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd));
340340

341341
if (err) {
342-
printk("Advertising failed to start (err %d)\n", err);
342+
LOG_ERR("Advertising failed to start (err %d)", err);
343343
return;
344344
}
345345

346-
printk("Advertising successfully started\n");
346+
LOG_INF("Advertising successfully started");
347347
}
348348

349349
static void advertising_start(void)
@@ -390,7 +390,7 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
390390

391391
static void recycled_cb(void)
392392
{
393-
printk("Connection object available from previous conn. Disconnect is complete!\n");
393+
LOG_INF("Connection object available from previous conn. Disconnect is complete!");
394394
advertising_start();
395395
}
396396

@@ -616,13 +616,13 @@ int main(void)
616616
if (IS_ENABLED(CONFIG_BT_NUS_SECURITY_ENABLED)) {
617617
err = bt_conn_auth_cb_register(&conn_auth_callbacks);
618618
if (err) {
619-
printk("Failed to register authorization callbacks.\n");
619+
LOG_ERR("Failed to register authorization callbacks. (err: %d)", err);
620620
return 0;
621621
}
622622

623623
err = bt_conn_auth_info_cb_register(&conn_auth_info_callbacks);
624624
if (err) {
625-
printk("Failed to register authorization info callbacks.\n");
625+
LOG_ERR("Failed to register authorization info callbacks. (err: %d)", err);
626626
return 0;
627627
}
628628
}

0 commit comments

Comments
 (0)