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.
This commit is contained in:
parent
c28f9df63a
commit
b0feef7a57
@ -1,4 +1,5 @@
|
|||||||
CONFIG_STDOUT_CONSOLE=y
|
CONFIG_STDOUT_CONSOLE=y
|
||||||
CONFIG_CONSOLE_HANDLER=y
|
CONFIG_CONSOLE_HANDLER=y
|
||||||
|
CONFIG_UART_CONSOLE_DEBUG_SERVER_HOOKS=y
|
||||||
CONFIG_NEWLIB_LIBC=y
|
CONFIG_NEWLIB_LIBC=y
|
||||||
CONFIG_FLOAT=y
|
CONFIG_FLOAT=y
|
||||||
|
@ -28,7 +28,7 @@ static struct nano_sem uart_sem;
|
|||||||
static uint8_t uart_ringbuf[UART_BUFSIZE];
|
static uint8_t uart_ringbuf[UART_BUFSIZE];
|
||||||
static uint8_t i_get, i_put;
|
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);
|
int i_next = (i_put + 1) & (UART_BUFSIZE - 1);
|
||||||
if (i_next == i_get) {
|
if (i_next == i_get) {
|
||||||
@ -58,8 +58,7 @@ uint8_t zephyr_getchar(void) {
|
|||||||
|
|
||||||
void zephyr_getchar_init(void) {
|
void zephyr_getchar_init(void) {
|
||||||
nano_sem_init(&uart_sem);
|
nano_sem_init(&uart_sem);
|
||||||
struct device *uart_console_dev = device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME);
|
uart_console_in_debug_hook_install(console_irq_input_hook);
|
||||||
uart_irq_input_hook_set(uart_console_dev, console_irq_input_hook);
|
|
||||||
// All NULLs because we're interested only in the callback above
|
// All NULLs because we're interested only in the callback above
|
||||||
uart_register_input(NULL, NULL, NULL);
|
uart_register_input(NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user