Skip to content

Commit 6d79ee2

Browse files
committed
macros
1 parent 719467e commit 6d79ee2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

examples/uart_main/uart_main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
#include <stdio.h>
2121
#include <uart/api.h>
2222

23+
//Macros for generating function names
24+
#define CREATE_FAST_UART(uart_name,tx_pin) #uart_name#tx_pin"init()"
25+
#define SEND_FAST_UART(uart_name,tx_pin) uart_name##tx_pin##_tx
26+
2327
//Used for setting the baud rate.
2428
//Currently unimplemented
2529
enum uart_baud baud;
@@ -35,5 +39,5 @@ void main(void)
3539

3640
void putchar(char c)
3741
{
38-
uartX_tx(c);
42+
SEND_FAST_UART(uart,X)(c);
3943
}

0 commit comments

Comments
 (0)