[riot-notifications] [RIOT-OS/RIOT] How to handle shared UART ISR for STM32F0 (#11119)

Wojciech NiziƄski notifications at github.com
Thu Mar 7 13:44:03 CET 2019


Ok, I will create some universal macrology to support maximum possible number of shared USARTs (max I found is 6 for USART3 to 8).

Let explain on my configuration:
```c
static const uart_conf_t uart_config[] = {
    {        .dev        = USART1,        .irqn       = USART1_IRQn    },
    {        .dev        = USART3,        .irqn       = USART3_6_IRQn    },
    {        .dev        = USART5,        .irqn       = USART3_6_IRQn    }
};
```

Enable normal (not shared) USART1:
```c
#define UART_0_ISR        (isr_usart1)
```
Two shared USARTs:
```c
#define UART_SHARED_ISR      (isr_usart3_6)
```
And now it is needed to know which UARTs should be handled inside `UART_SHARED_ISR`.
I can use exsting defines:
```c
#define UART_1_ISR          (isr_usart3_6)
#define UART_2_ISR          (isr_usart3_6)
```
and add some additional preprocesor conditions (in uart.c) to do not enable generic handlers and handle specified UARTs inside shared handler.

Another way (to do not complicate) is to define new symbols, like: 
```c
#define UART_SHARED_ISR      (isr_usart3_6)
#  define UART_1_ISR_SHARED
#  define UART_2_ISR_SHARED
```

What way do you prefer?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/issues/11119#issuecomment-470511289
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190307/5d7c8ac3/attachment.html>


More information about the notifications mailing list