|
31 | 31 | #include "HardwareSerial.h" |
32 | 32 |
|
33 | 33 |
|
34 | | -#define SERIAL_BUFFER_SIZE 16 |
35 | | -typedef struct ring_buffer |
36 | | -{ |
37 | | - unsigned char buffer[SERIAL_BUFFER_SIZE]; |
38 | | - volatile unsigned int head; |
39 | | - volatile unsigned int tail; |
40 | | -} ring_buffer; |
41 | | - |
42 | | -static ring_buffer rx_buffer;// = { { 0 }, 0, 0}; |
43 | | -static ring_buffer tx_buffer;// = { { 0 }, 0, 0}; |
44 | | - |
45 | | -static volatile char transmitting;//=0; |
46 | | -static unsigned char initialized;//=0 internal status. Returned on HardwareSerial() |
47 | | - |
48 | 34 | // device dependent definitions //////////////////////////////////////////// |
49 | 35 |
|
50 | 36 | #if defined(UART1) |
@@ -120,7 +106,34 @@ static unsigned char initialized;//=0 internal status. Returned on HardwareSeria |
120 | 106 | #endif |
121 | 107 |
|
122 | 108 |
|
123 | | -// private functions ////////////////////////////////////////////////////////// |
| 109 | +#ifdef NO_SERIAL |
| 110 | +/* |
| 111 | + * empty default IRQ functions to make the linker happy if the |
| 112 | + * respective module is not to linked. |
| 113 | + */ |
| 114 | + |
| 115 | +void UARTx_TX_IRQHandler(void) __interrupt(ITC_IRQ_UARTx_TX){} |
| 116 | +void UARTx_RX_IRQHandler(void) __interrupt(ITC_IRQ_UARTx_RX){} |
| 117 | +#else // ifdef NO_SERIAL |
| 118 | + |
| 119 | + |
| 120 | +// private data ////////////////////////////////////////////////////////////// |
| 121 | + |
| 122 | +#define SERIAL_BUFFER_SIZE 16 |
| 123 | +typedef struct ring_buffer |
| 124 | +{ |
| 125 | + unsigned char buffer[SERIAL_BUFFER_SIZE]; |
| 126 | + volatile unsigned int head; |
| 127 | + volatile unsigned int tail; |
| 128 | +} ring_buffer; |
| 129 | + |
| 130 | +static ring_buffer rx_buffer;// = { { 0 }, 0, 0}; |
| 131 | +static ring_buffer tx_buffer;// = { { 0 }, 0, 0}; |
| 132 | + |
| 133 | +static volatile char transmitting;//=0; |
| 134 | +static unsigned char initialized;//=0 internal status. Returned on HardwareSerial() |
| 135 | + |
| 136 | +// private functions //////////////////////////////////////////////////////// |
124 | 137 |
|
125 | 138 | static void store_char(unsigned char c, ring_buffer *buffer) |
126 | 139 | //inline void store_char(unsigned char c, ring_buffer *buffer) |
@@ -347,3 +360,5 @@ size_t HardwareSerial_write(uint8_t c) |
347 | 360 |
|
348 | 361 | return 1; |
349 | 362 | } |
| 363 | + |
| 364 | +#endif // ifdef NO_SERIAL |
0 commit comments