From bc849c707816a59c75e85d415ceb6e3db3f54677 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Wed, 22 Nov 2023 17:04:28 +0000 Subject: [PATCH] input: kbd_matrix: add print helper define Add a print helper define for the keyboard matrix row paired with the row typedef. Signed-off-by: Fabio Baltieri --- drivers/input/input_kbd_matrix.c | 2 +- include/zephyr/input/input_kbd_matrix.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/input/input_kbd_matrix.c b/drivers/input/input_kbd_matrix.c index af3e197468..ee830beac2 100644 --- a/drivers/input/input_kbd_matrix.c +++ b/drivers/input/input_kbd_matrix.c @@ -212,7 +212,7 @@ static bool input_kbd_matrix_check_key_events(const struct device *dev) key_pressed = input_kbd_matrix_scan(dev); for (int c = 0; c < cfg->col_size; c++) { - LOG_DBG("c=%2d u=%02x p=%02x n=%02x", + LOG_DBG("c=%2d u=" PRIkbdrow " p=" PRIkbdrow " n=" PRIkbdrow, c, cfg->matrix_unstable_state[c], cfg->matrix_previous_state[c], diff --git a/include/zephyr/input/input_kbd_matrix.h b/include/zephyr/input/input_kbd_matrix.h index 301e8b0311..2ae1ee56b1 100644 --- a/include/zephyr/input/input_kbd_matrix.h +++ b/include/zephyr/input/input_kbd_matrix.h @@ -32,8 +32,10 @@ /** Row entry data type */ #if CONFIG_INPUT_KBD_MATRIX_16_BIT_ROW typedef uint16_t kbd_row_t; +#define PRIkbdrow "%04x" #else typedef uint8_t kbd_row_t; +#define PRIkbdrow "%02x" #endif /** Maximum number of rows */