Skip to content

Commit 663e89b

Browse files
MirkoCovizzilemrey
authored andcommitted
samples: buttons: remove logging
This sample has inconsistent use of logging mixed with printks. Since logging is not really needed here, remove it in favor of printk. This makes it more aligned with the other samples. Signed-off-by: Mirko Covizzi <[email protected]>
1 parent 8e4bfb2 commit 663e89b

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

samples/buttons/src/main.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include <zephyr/kernel.h> /* k_busy_wait() */
88
#include <zephyr/sys_clock.h> /* K_MSEC() */
9-
#include <zephyr/logging/log.h>
109

1110
#include <lite_timer.h>
1211
#include <lite_buttons.h>
@@ -18,8 +17,6 @@
1817

1918
#include <board-config.h>
2019

21-
LOG_MODULE_REGISTER(buttons_sample, LOG_LEVEL_INF);
22-
2320
#define PIN_BTN_0 BOARD_PIN_BTN_0
2421
#define PIN_BTN_1 BOARD_PIN_BTN_1
2522
#define PIN_BTN_2 BOARD_PIN_BTN_2
@@ -29,7 +26,7 @@ static volatile bool running;
2926

3027
static void button_handler(uint8_t pin, uint8_t action)
3128
{
32-
LOG_INF("Button event callback: %d, %d", pin, action);
29+
printk("Button event callback: %d, %d\n", pin, action);
3330

3431
if (pin == PIN_BTN_3) {
3532
running = false;
@@ -40,7 +37,7 @@ int main(void)
4037
{
4138
int err;
4239

43-
LOG_INF("Buttons sample started\n");
40+
printk("Buttons sample started\n");
4441

4542
#if CONFIG_SOFTDEVICE
4643
err = nrf_sdh_enable_request();
@@ -89,17 +86,17 @@ int main(void)
8986

9087
err = lite_buttons_init(configs, ARRAY_SIZE(configs), LITE_BUTTONS_DETECTION_DELAY_MIN_US);
9188
if (err) {
92-
LOG_ERR("Failed to initialize buttons, err: %d", err);
89+
printk("Failed to initialize buttons, err: %d\n", err);
9390
return err;
9491
}
9592

9693
err = lite_buttons_enable();
9794
if (err) {
98-
LOG_ERR("Failed to enable buttons, err: %d", err);
95+
printk("Failed to enable buttons, err: %d\n", err);
9996
return err;
10097
}
10198

102-
LOG_INF("Buttons initialized, press button 3 to terminate");
99+
printk("Buttons initialized, press button 3 to terminate\n");
103100

104101
while (running) {
105102
/* Sleep */
@@ -108,11 +105,11 @@ int main(void)
108105

109106
err = lite_buttons_deinit();
110107
if (err) {
111-
LOG_ERR("Failed to deinitialize buttons, err: %d", err);
108+
printk("Failed to deinitialize buttons, err: %d\n", err);
112109
return err;
113110
}
114111

115-
LOG_INF("Bye");
112+
printk("Bye\n");
116113

117114
return 0;
118115
}

0 commit comments

Comments
 (0)