diff options
author | Uros Majstorovic <majstor@majstor.org> | 2020-02-19 06:47:43 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2020-02-19 06:47:43 +0100 |
commit | 6666a131ab36b1d96a854da80524d860f9a3884b (patch) | |
tree | 5039423cb8c5592c20f8dd3aec417158ac058484 /code/fe310/eos/uart.c | |
parent | 15bddabc5cbe0e751fadcaaa7f7c7c36bca61331 (diff) |
eve long press/double tap/inertial scroll
spi flush bugfix
resolved dependecies: spi -> net; event -> net
renamed various handlers
Diffstat (limited to 'code/fe310/eos/uart.c')
-rw-r--r-- | code/fe310/eos/uart.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/code/fe310/eos/uart.c b/code/fe310/eos/uart.c index 95c9057..e9349a7 100644 --- a/code/fe310/eos/uart.c +++ b/code/fe310/eos/uart.c @@ -12,9 +12,9 @@ #include "uart.h" #include "irq_def.h" -static eos_uart_fptr_t uart_handler[EOS_UART_MAX_ETYPE]; +static eos_uart_handler_t uart_handler[EOS_UART_MAX_ETYPE]; -static void uart_handler_evt(unsigned char type, unsigned char *buffer, uint16_t len) { +static void uart_handle_evt(unsigned char type, unsigned char *buffer, uint16_t len) { unsigned char idx = (type & ~EOS_EVT_MASK) - 1; if ((idx < EOS_UART_MAX_ETYPE) && uart_handler[idx]) { @@ -24,7 +24,7 @@ static void uart_handler_evt(unsigned char type, unsigned char *buffer, uint16_t } } -static void uart_handler_intr(void) { +static void uart_handle_intr(void) { if (UART0_REG(UART_REG_IP) & UART_IP_TXWM) { UART0_REG(UART_REG_IE) &= ~UART_IP_TXWM; eos_evtq_push_isr(EOS_EVT_UART | EOS_UART_ETYPE_TX, NULL, 0); @@ -41,19 +41,12 @@ void eos_uart_init(void) { for (i=0; i<EOS_UART_MAX_ETYPE; i++) { uart_handler[i] = NULL; } - eos_evtq_set_handler(EOS_EVT_UART, uart_handler_evt, 0); - eos_intr_set(INT_UART0_BASE, IRQ_PRIORITY_UART, uart_handler_intr); + eos_evtq_set_handler(EOS_EVT_UART, uart_handle_evt); + eos_intr_set(INT_UART0_BASE, IRQ_PRIORITY_UART, uart_handle_intr); } -void eos_uart_set_handler(unsigned char type, eos_uart_fptr_t handler, uint8_t flags) { - if (type && (type <= EOS_UART_MAX_ETYPE)) { - type--; - } else { - return; - } - uart_handler[type] = handler; - - eos_evtq_set_hflags(EOS_EVT_UART | type + 1, flags); +void eos_uart_set_handler(unsigned char type, eos_uart_handler_t handler) { + if (type && (type <= EOS_UART_MAX_ETYPE)) uart_handler[type - 1] = handler; } void eos_uart_txwm_set(uint8_t wm) { |