aboutsummaryrefslogtreecommitdiff
path: root/libraries/SoftwareSerial/SoftwareSerial.h
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2014-04-23 19:16:21 +0200
committerMatthijs Kooijman <matthijs@stdin.nl>2015-01-26 17:03:25 +0100
commit08c3bfdc9fd5da81932ec9e4df0b645c93f2ebdc (patch)
tree985a53c7872f47b4920be36edf9dcf3ef1994511 /libraries/SoftwareSerial/SoftwareSerial.h
parent5f2f0ef4c8f44aefe5c715abf28f9eda32fcf67e (diff)
Disable the RX PCINT inside SoftwareSerial::recv
Before, the interrupt would remain enabled during reception, which would re-set the PCINT flag because of the level changes inside the received byte. Because interrupts are globally disabled, this would not immediately trigger an interrupt, but the flag would be remembered to trigger another PCINT interrupt immediately after the first one is processed. Typically this was not a problem, because the second interrupt would see the stop bit, or an idle line, and decide that the interrupt triggered for someone else. However, at high baud rates, this could cause the next interrupt for the real start bit to be delayed so much that the byte got corrupted. By clearing the interrupt mask bit for just the RX pin (as opposed to the PCINT mask bit for the entire port), any PCINT events on other bits can still set the PCINT flag and be processed as normal. In this case, it's likely that there will be corruption, but that's inevitable when (other) interrupts happen during SoftwareSerial reception.
Diffstat (limited to 'libraries/SoftwareSerial/SoftwareSerial.h')
-rw-r--r--libraries/SoftwareSerial/SoftwareSerial.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libraries/SoftwareSerial/SoftwareSerial.h b/libraries/SoftwareSerial/SoftwareSerial.h
index 302a23b..2b12598 100644
--- a/libraries/SoftwareSerial/SoftwareSerial.h
+++ b/libraries/SoftwareSerial/SoftwareSerial.h
@@ -76,7 +76,7 @@ private:
void tx_pin_write(uint8_t pin_state) __attribute__((__always_inline__));
void setTX(uint8_t transmitPin);
void setRX(uint8_t receivePin);
- void setRxIntMsk(bool enable);
+ void setRxIntMsk(bool enable) __attribute__((__always_inline__));
// private static method for timing
static inline void tunedDelay(uint16_t delay);