|
15 | 15 | SoftwareSerial support for the Artemis
|
16 | 16 | Any pin can be used for software serial receive or transmit
|
17 | 17 | at 300 to 115200bps and anywhere inbetween.
|
18 |
| - Limitations: |
19 |
| - Uses Timer/Compare module H. This will remove PWM capabilities |
| 18 | + Limitations (similar to Arduino core SoftwareSerial): |
| 19 | + * RX on one pin at a time. |
| 20 | + * No TX and RX at the same time. |
| 21 | + * TX gets priority. So if Artemis is receiving a string of characters |
| 22 | + and you do a Serial.print() the print will begin immediately and any additional |
| 23 | + RX characters will be lost. |
| 24 | + * Uses Timer/Compare module H (aka 7). This will remove PWM capabilities |
20 | 25 | on some pins.
|
21 |
| - Parity is supported but not checked during RX. |
| 26 | + * Parity is supported during TX but not checked during RX. |
| 27 | + * Enabling multiple ports causes 115200 RX to fail (because there is additional instance switching overhead) |
| 28 | +
|
22 | 29 |
|
23 | 30 | Development environment specifics:
|
24 | 31 | Arduino IDE 1.8.x
|
@@ -76,6 +83,9 @@ void SoftwareSerial::begin(uint32_t baudRate)
|
76 | 83 |
|
77 | 84 | void SoftwareSerial::listen()
|
78 | 85 | {
|
| 86 | + // Disable the timer interrupt in the NVIC. |
| 87 | + NVIC_DisableIRQ(STIMER_CMPR7_IRQn); |
| 88 | + |
79 | 89 | if (ap3_active_softwareserial_handle != NULL)
|
80 | 90 | ap3_active_softwareserial_handle->stopListening(); //Gracefully shut down previous instance
|
81 | 91 |
|
@@ -179,6 +189,14 @@ int SoftwareSerial::peek()
|
179 | 189 | return (rxBuffer[tempTail]);
|
180 | 190 | }
|
181 | 191 |
|
| 192 | +//Wait for TX buffer to get sent |
| 193 | +void SoftwareSerial::flush() |
| 194 | +{ |
| 195 | + while (txInUse) |
| 196 | + { |
| 197 | + } |
| 198 | +} |
| 199 | + |
182 | 200 | //Returns true if overflow flag is set
|
183 | 201 | //Clears flag when called
|
184 | 202 | bool SoftwareSerial::overflow()
|
|
0 commit comments