Skip to content

Commit a713d4b

Browse files
author
Andrew Boie
committed
Revert "misc: Remove generic PRINT macros from button samples"
This reverts commit 2939752. Change-Id: I36b8788938bcfa0db48ef618919a9821714096d0 Signed-off-by: Andrew Boie <[email protected]>
1 parent b3d6593 commit a713d4b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

samples/drivers/button/prj.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
CONFIG_STDOUT_CONSOLE=y
2-
CONFIG_SYS_LOG=y

samples/drivers/button/src/main.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@
1919
#include <gpio.h>
2020
#include <misc/util.h>
2121

22-
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
23-
#include <misc/sys_log.h>
22+
#if defined(CONFIG_STDOUT_CONSOLE)
23+
#include <stdio.h>
24+
#define PRINT printf
25+
#else
26+
#include <misc/printk.h>
27+
#define PRINT printk
28+
#endif
2429

2530
/* change this to use another GPIO port */
2631
#define PORT "GPIOC"
@@ -35,7 +40,7 @@
3540
void button_pressed(struct device *gpiob,
3641
struct gpio_callback *cb, uint32_t pins)
3742
{
38-
SYS_LOG_INF("Button pressed at %d", sys_tick_get_32());
43+
PRINT("Button pressed at %d\n", sys_tick_get_32());
3944
}
4045

4146
static struct gpio_callback gpio_cb;
@@ -60,7 +65,7 @@ void main(void)
6065
int val = 0;
6166

6267
gpio_pin_read(gpiob, PIN, &val);
63-
SYS_LOG_INF("GPIO val: %d", val);
68+
PRINT("GPIO val: %d\n", val);
6469
task_sleep(MSEC(500));
6570
}
6671
}

0 commit comments

Comments
 (0)