Skip to content
Permalink
Browse files

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>
  • Loading branch information...
rettichschnidi authored and carlescufi committed Jul 30, 2019
1 parent 7f757e6 commit 61733a8fe56a5d1cf0e6c21446a8d4bb1a20b040
Showing with 2 additions and 1 deletion.
  1. +2 −1 samples/basic/button/src/main.c
@@ -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;

0 comments on commit 61733a8

Please sign in to comment.
You can’t perform that action at this time.