Replies: 5 comments 8 replies
-
Hey Andreas! I know there is so much redundancy in the UART drivers... a relic from the early days of this project... 😅 I like the idea of cleaning up this mess, but I do not understand your proposal. Do you want to add a new argument to all UART functions that is used to pass the actual HW-access struct?? And then uses macros to provide backwards compatibility? |
Beta Was this translation helpful? Give feedback.
-
Hi Stephan,
yes, then you can distinguish between UART0 and UART1 with the given Basepointer
excatly :) BR, |
Beta Was this translation helpful? Give feedback.
-
Hi Stephan, see here the start of the changes. main...akaeba:neorv32:common_neorv32_uart_functions At the moment i stumble a little with the functions:
The issue to distinguish between BR, |
Beta Was this translation helpful? Give feedback.
-
Hello, if you look at how this was done in the ST library, then the definitions for the NEORV32 UART would look like this:
And the prototypes could look like:
And for the compatibility:
And a call with the new setup for UART0 will look like:
And at the same time, the old way will work too:
Best regards, |
Beta Was this translation helpful? Give feedback.
-
@emb4fun : let us work together on this PR. As next I introduce Stephans recommendation to move the c macros to the legacy.h function. |
Beta Was this translation helpful? Give feedback.
-
Hi Stephan,
in the file neorv32_uart.c are for uart0 and uart1 the same mechanics defined, see f.e.
neorv32_uart0_disable
andneorv32_uart1_disable
. The common definition of the register layout in neorv32_uart_t would allow to define a prototype forvoid neorv32_uart0_disable(void)
in the way ```void neorv32_uart_disable(neorv32_uart_t *self) and redefine to original function name space in the neorv32_uart.h. The header would look in the following way:Issued Function could be:
Same for UART1.
For
neorv32_uart0_setup
i have doubts about the textmode.What do dou think? If you like i can prepare a PR.
BR,
Andreas
Beta Was this translation helpful? Give feedback.
All reactions