diff --git a/samples/drivers/button/prj.conf b/samples/drivers/button/prj.conf index 8b042db5406..bab9c297fd4 100644 --- a/samples/drivers/button/prj.conf +++ b/samples/drivers/button/prj.conf @@ -1 +1,2 @@ CONFIG_STDOUT_CONSOLE=y +CONFIG_SYS_LOG=y diff --git a/samples/drivers/button/src/main.c b/samples/drivers/button/src/main.c index 08a38290bfb..f69821568fa 100644 --- a/samples/drivers/button/src/main.c +++ b/samples/drivers/button/src/main.c @@ -19,13 +19,8 @@ #include #include -#if defined(CONFIG_STDOUT_CONSOLE) -#include -#define PRINT printf -#else -#include -#define PRINT printk -#endif +#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO +#include /* change this to use another GPIO port */ #define PORT "GPIOC" @@ -40,7 +35,7 @@ void button_pressed(struct device *gpiob, struct gpio_callback *cb, uint32_t pins) { - PRINT("Button pressed at %d\n", sys_tick_get_32()); + SYS_LOG_INF("Button pressed at %d", sys_tick_get_32()); } static struct gpio_callback gpio_cb; @@ -65,7 +60,7 @@ void main(void) int val = 0; gpio_pin_read(gpiob, PIN, &val); - PRINT("GPIO val: %d\n", val); + SYS_LOG_INF("GPIO val: %d", val); task_sleep(MSEC(500)); } }