sample: button: Fix format specifier

k_cycle_get_32() returns an unsigned 32-bit integer, while the '%d'
specifier denotes a signed integer.
Using the proper C99 format specifier resolves the problem.

Signed-off-by: Reto Schneider <code@reto-schneider.ch>
This commit is contained in:
Reto Schneider 2019-07-31 00:45:57 +02:00 committed by Carles Cufí
commit 61733a8fe5

View file

@ -9,6 +9,7 @@
#include <drivers/gpio.h>
#include <sys/util.h>
#include <sys/printk.h>
#include <inttypes.h>
/* change this to use another GPIO port */
#ifndef DT_ALIAS_SW0_GPIOS_CONTROLLER
@ -55,7 +56,7 @@
void button_pressed(struct device *gpiob, struct gpio_callback *cb,
u32_t pins)
{
printk("Button pressed at %d\n", k_cycle_get_32());
printk("Button pressed at %" PRIu32 "\n", k_cycle_get_32());
}
static struct gpio_callback gpio_cb;