|
| 1 | +#ifndef WIRING_SERIAL_H |
| 2 | +#define WIRING_SERIAL_H |
| 3 | + |
| 4 | +#include "variant.h" |
| 5 | +#include "HardwareSerial.h" |
| 6 | + |
| 7 | +#if defined(HAL_UART_MODULE_ENABLED) |
| 8 | + |
| 9 | +#if !defined(HWSERIAL_NONE) && defined(SERIAL_UART_INSTANCE) |
| 10 | +#if SERIAL_UART_INSTANCE == 0 |
| 11 | +#define ENABLE_HWSERIALLP1 |
| 12 | +#if !defined(Serial) |
| 13 | +#define Serial SerialLP1 |
| 14 | +#define serialEvent serialEventLP1 |
| 15 | +#endif |
| 16 | +#elif SERIAL_UART_INSTANCE == 1 |
| 17 | +#define ENABLE_HWSERIAL1 |
| 18 | +#if !defined(Serial) |
| 19 | +#define Serial Serial1 |
| 20 | +#define serialEvent serialEvent1 |
| 21 | +#endif |
| 22 | +#elif SERIAL_UART_INSTANCE == 2 |
| 23 | +#define ENABLE_HWSERIAL2 |
| 24 | +#if !defined(Serial) |
| 25 | +#define Serial Serial2 |
| 26 | +#define serialEvent serialEvent2 |
| 27 | +#endif |
| 28 | +#elif SERIAL_UART_INSTANCE == 3 |
| 29 | +#define ENABLE_HWSERIAL3 |
| 30 | +#if !defined(Serial) |
| 31 | +#define Serial Serial3 |
| 32 | +#define serialEvent serialEvent3 |
| 33 | +#endif |
| 34 | +#elif SERIAL_UART_INSTANCE == 4 |
| 35 | +#define ENABLE_HWSERIAL4 |
| 36 | +#if !defined(Serial) |
| 37 | +#define Serial Serial4 |
| 38 | +#define serialEvent serialEvent4 |
| 39 | +#endif |
| 40 | +#elif SERIAL_UART_INSTANCE == 5 |
| 41 | +#define ENABLE_HWSERIAL5 |
| 42 | +#if !defined(Serial) |
| 43 | +#define Serial Serial5 |
| 44 | +#define serialEvent serialEvent5 |
| 45 | +#endif |
| 46 | +#elif SERIAL_UART_INSTANCE == 6 |
| 47 | +#define ENABLE_HWSERIAL6 |
| 48 | +#if !defined(Serial) |
| 49 | +#define Serial Serial6 |
| 50 | +#define serialEvent serialEvent6 |
| 51 | +#endif |
| 52 | +#elif SERIAL_UART_INSTANCE == 7 |
| 53 | +#define ENABLE_HWSERIAL7 |
| 54 | +#if !defined(Serial) |
| 55 | +#define Serial Serial7 |
| 56 | +#define serialEvent serialEvent7 |
| 57 | +#endif |
| 58 | +#elif SERIAL_UART_INSTANCE == 8 |
| 59 | +#define ENABLE_HWSERIAL8 |
| 60 | +#if !defined(Serial) |
| 61 | +#define Serial Serial8 |
| 62 | +#define serialEvent serialEvent8 |
| 63 | +#endif |
| 64 | +#elif SERIAL_UART_INSTANCE == 9 |
| 65 | +#define ENABLE_HWSERIAL9 |
| 66 | +#if !defined(Serial) |
| 67 | +#define Serial Serial9 |
| 68 | +#define serialEvent serialEvent9 |
| 69 | +#endif |
| 70 | +#elif SERIAL_UART_INSTANCE == 10 |
| 71 | +#define ENABLE_HWSERIAL10 |
| 72 | +#if !defined(Serial) |
| 73 | +#define Serial Serial10 |
| 74 | +#define serialEvent serialEvent10 |
| 75 | +#endif |
| 76 | +#else |
| 77 | +#if !defined(Serial) |
| 78 | +#warning "No generic 'Serial' defined!" |
| 79 | +#endif |
| 80 | +#endif /* SERIAL_UART_INSTANCE == x */ |
| 81 | +#endif /* !HWSERIAL_NONE && SERIAL_UART_INSTANCE */ |
| 82 | + |
| 83 | +#if defined(ENABLE_HWSERIALLP1) |
| 84 | +#if defined(LPUART1_BASE) |
| 85 | +#define HAVE_HWSERIALLP1 |
| 86 | +#endif |
| 87 | +#endif |
| 88 | +#if defined(ENABLE_HWSERIAL1) |
| 89 | +#if defined(USART1_BASE) |
| 90 | +#define HAVE_HWSERIAL1 |
| 91 | +#endif |
| 92 | +#endif |
| 93 | +#if defined(ENABLE_HWSERIAL2) |
| 94 | +#if defined(USART2_BASE) |
| 95 | +#define HAVE_HWSERIAL2 |
| 96 | +#endif |
| 97 | +#endif |
| 98 | +#if defined(ENABLE_HWSERIAL3) |
| 99 | +#if defined(USART3_BASE) |
| 100 | +#define HAVE_HWSERIAL3 |
| 101 | +#endif |
| 102 | +#endif |
| 103 | +#if defined(ENABLE_HWSERIAL4) |
| 104 | +#if defined(USART4_BASE) || defined(UART4_BASE) |
| 105 | +#define HAVE_HWSERIAL4 |
| 106 | +#endif |
| 107 | +#endif |
| 108 | +#if defined(ENABLE_HWSERIAL5) |
| 109 | +#if defined(USART5_BASE) || defined(UART5_BASE) |
| 110 | +#define HAVE_HWSERIAL5 |
| 111 | +#endif |
| 112 | +#endif |
| 113 | +#if defined(ENABLE_HWSERIAL6) |
| 114 | +#if defined(USART6_BASE) |
| 115 | +#define HAVE_HWSERIAL6 |
| 116 | +#endif |
| 117 | +#endif |
| 118 | +#if defined(ENABLE_HWSERIAL7) |
| 119 | +#if defined(USART7_BASE) || defined(UART7_BASE) |
| 120 | +#define HAVE_HWSERIAL7 |
| 121 | +#endif |
| 122 | +#endif |
| 123 | +#if defined(ENABLE_HWSERIAL8) |
| 124 | +#if defined(USART8_BASE) || defined(UART8_BASE) |
| 125 | +#define HAVE_HWSERIAL8 |
| 126 | +#endif |
| 127 | +#endif |
| 128 | +#if defined(ENABLE_HWSERIAL9) |
| 129 | +#if defined(UART9_BASE) |
| 130 | +#define HAVE_HWSERIAL9 |
| 131 | +#endif |
| 132 | +#endif |
| 133 | +#if defined(ENABLE_HWSERIAL10) |
| 134 | +#if defined(UART10_BASE) |
| 135 | +#define HAVE_HWSERIAL10 |
| 136 | +#endif |
| 137 | +#endif |
| 138 | + |
| 139 | +extern void serialEvent1(void) __attribute__((weak)); |
| 140 | +extern void serialEvent2(void) __attribute__((weak)); |
| 141 | +extern void serialEvent3(void) __attribute__((weak)); |
| 142 | +extern void serialEvent4(void) __attribute__((weak)); |
| 143 | +extern void serialEvent5(void) __attribute__((weak)); |
| 144 | +extern void serialEvent6(void) __attribute__((weak)); |
| 145 | +extern void serialEvent7(void) __attribute__((weak)); |
| 146 | +extern void serialEvent8(void) __attribute__((weak)); |
| 147 | +extern void serialEvent9(void) __attribute__((weak)); |
| 148 | +extern void serialEvent10(void) __attribute__((weak)); |
| 149 | +extern void serialEventLP1(void) __attribute__((weak)); |
| 150 | + |
| 151 | +#endif /* HAL_UART_MODULE_ENABLED */ |
| 152 | +extern void serialEventRun(void) __attribute__((weak)); |
| 153 | + |
| 154 | +#endif // WIRING_SERIAL_H |
0 commit comments