Skip to content

Commit b0feef7

Browse files
committed
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.
1 parent c28f9df commit b0feef7

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

zephyr/prj.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
CONFIG_STDOUT_CONSOLE=y
22
CONFIG_CONSOLE_HANDLER=y
3+
CONFIG_UART_CONSOLE_DEBUG_SERVER_HOOKS=y
34
CONFIG_NEWLIB_LIBC=y
45
CONFIG_FLOAT=y

zephyr/src/zephyr_getchar.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static struct nano_sem uart_sem;
2828
static uint8_t uart_ringbuf[UART_BUFSIZE];
2929
static uint8_t i_get, i_put;
3030

31-
static int console_irq_input_hook(struct device *dev, uint8_t ch)
31+
static int console_irq_input_hook(uint8_t ch)
3232
{
3333
int i_next = (i_put + 1) & (UART_BUFSIZE - 1);
3434
if (i_next == i_get) {
@@ -58,8 +58,7 @@ uint8_t zephyr_getchar(void) {
5858

5959
void zephyr_getchar_init(void) {
6060
nano_sem_init(&uart_sem);
61-
struct device *uart_console_dev = device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME);
62-
uart_irq_input_hook_set(uart_console_dev, console_irq_input_hook);
61+
uart_console_in_debug_hook_install(console_irq_input_hook);
6362
// All NULLs because we're interested only in the callback above
6463
uart_register_input(NULL, NULL, NULL);
6564
}

0 commit comments

Comments
 (0)