misc: Remove generic PRINT macros from button samples
Remove generic PRINT macros from button samples and replace with SYS_LOG module. Jira: ZEP-240 Change-Id: Iae35d69a6a8473afdc1003ed629a21447a6f9a4a Signed-off-by: Juan Manuel Cruz Alcaraz <juan.m.cruz.alcaraz@intel.com>
This commit is contained in:
parent
b39399b069
commit
2939752a3e
2 changed files with 5 additions and 9 deletions
|
@ -1 +1,2 @@
|
||||||
CONFIG_STDOUT_CONSOLE=y
|
CONFIG_STDOUT_CONSOLE=y
|
||||||
|
CONFIG_SYS_LOG=y
|
||||||
|
|
|
@ -19,13 +19,8 @@
|
||||||
#include <gpio.h>
|
#include <gpio.h>
|
||||||
#include <misc/util.h>
|
#include <misc/util.h>
|
||||||
|
|
||||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
#define SYS_LOG_LEVEL SYS_LOG_LEVEL_INFO
|
||||||
#include <stdio.h>
|
#include <misc/sys_log.h>
|
||||||
#define PRINT printf
|
|
||||||
#else
|
|
||||||
#include <misc/printk.h>
|
|
||||||
#define PRINT printk
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* change this to use another GPIO port */
|
/* change this to use another GPIO port */
|
||||||
#define PORT "GPIOC"
|
#define PORT "GPIOC"
|
||||||
|
@ -40,7 +35,7 @@
|
||||||
void button_pressed(struct device *gpiob,
|
void button_pressed(struct device *gpiob,
|
||||||
struct gpio_callback *cb, uint32_t pins)
|
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;
|
static struct gpio_callback gpio_cb;
|
||||||
|
@ -65,7 +60,7 @@ void main(void)
|
||||||
int val = 0;
|
int val = 0;
|
||||||
|
|
||||||
gpio_pin_read(gpiob, PIN, &val);
|
gpio_pin_read(gpiob, PIN, &val);
|
||||||
PRINT("GPIO val: %d\n", val);
|
SYS_LOG_INF("GPIO val: %d", val);
|
||||||
task_sleep(MSEC(500));
|
task_sleep(MSEC(500));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue