Skip to content

Commit

Permalink
zephyr/zephyr_getchar: Update for recent Zephyr refactor of console h…
Browse files Browse the repository at this point in the history
…ooks.

uart_irq_input_hook_set() was renamed to uart_console_in_debug_hook_install()
and accepts different params.
  • Loading branch information
pfalcon committed Oct 26, 2016
1 parent ba58e4b commit 2610723
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions zephyr/prj.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CONFIG_STDOUT_CONSOLE=y
CONFIG_CONSOLE_HANDLER=y
CONFIG_UART_CONSOLE_DEBUG_SERVER_HOOKS=y
CONFIG_NEWLIB_LIBC=y
CONFIG_FLOAT=y
CONFIG_MAIN_STACK_SIZE=4096
Expand Down
5 changes: 2 additions & 3 deletions zephyr/src/zephyr_getchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}

0 comments on commit 2610723

Please sign in to comment.