From b0feef7a57cc31cb54be39839411962abef6d838 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 26 Oct 2016 17:49:20 +0300 Subject: [PATCH] zephyr/zephyr_getchar: Update for recent Zephyr refactor of console hooks. uart_irq_input_hook_set() was renamed to uart_console_in_debug_hook_install() and accepts different params. --- zephyr/prj.conf | 1 + zephyr/src/zephyr_getchar.c | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/zephyr/prj.conf b/zephyr/prj.conf index 35cb036de..0b0827d25 100644 --- a/zephyr/prj.conf +++ b/zephyr/prj.conf @@ -1,4 +1,5 @@ CONFIG_STDOUT_CONSOLE=y CONFIG_CONSOLE_HANDLER=y +CONFIG_UART_CONSOLE_DEBUG_SERVER_HOOKS=y CONFIG_NEWLIB_LIBC=y CONFIG_FLOAT=y diff --git a/zephyr/src/zephyr_getchar.c b/zephyr/src/zephyr_getchar.c index 89e3e0efb..0f673c9c8 100644 --- a/zephyr/src/zephyr_getchar.c +++ b/zephyr/src/zephyr_getchar.c @@ -28,7 +28,7 @@ static struct nano_sem uart_sem; static uint8_t uart_ringbuf[UART_BUFSIZE]; static uint8_t i_get, i_put; -static int console_irq_input_hook(struct device *dev, uint8_t ch) +static int console_irq_input_hook(uint8_t ch) { int i_next = (i_put + 1) & (UART_BUFSIZE - 1); if (i_next == i_get) { @@ -58,8 +58,7 @@ uint8_t zephyr_getchar(void) { void zephyr_getchar_init(void) { nano_sem_init(&uart_sem); - struct device *uart_console_dev = device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME); - uart_irq_input_hook_set(uart_console_dev, console_irq_input_hook); + uart_console_in_debug_hook_install(console_irq_input_hook); // All NULLs because we're interested only in the callback above uart_register_input(NULL, NULL, NULL); }