mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-11 22:24:13 +01:00
Fix idle level when initializing a inverted SoftwareSerial
Previously, when SoftwareSerial was initialized, it would always be set to an idle level of HIGH, even when inverted logic was enabled. Once a byte is transmitted, the idle level gets correctly set to LOW instead. This commit makes sure that the idle level is correct directly after initialization already. This fixes #1361.
This commit is contained in:
parent
9ad8748d40
commit
17e1eb5ef2
@ -355,7 +355,7 @@ SoftwareSerial::~SoftwareSerial()
|
|||||||
void SoftwareSerial::setTX(uint8_t tx)
|
void SoftwareSerial::setTX(uint8_t tx)
|
||||||
{
|
{
|
||||||
pinMode(tx, OUTPUT);
|
pinMode(tx, OUTPUT);
|
||||||
digitalWrite(tx, HIGH);
|
digitalWrite(tx, _inverse_logic ? LOW : HIGH);
|
||||||
_transmitBitMask = digitalPinToBitMask(tx);
|
_transmitBitMask = digitalPinToBitMask(tx);
|
||||||
uint8_t port = digitalPinToPort(tx);
|
uint8_t port = digitalPinToPort(tx);
|
||||||
_transmitPortRegister = portOutputRegister(port);
|
_transmitPortRegister = portOutputRegister(port);
|
||||||
|
Loading…
Reference in New Issue
Block a user