Skip to content

Commit 93df867

Browse files
authored
Merge pull request #522 from LeeLeahy2/fix-rts-cts
Fix RTS and CTS to match the SAMD21 specification
2 parents 5c12c5e + f986ba4 commit 93df867

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Firmware/LoRaSerial/Serial.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ bool isCTS()
1414
{
1515
if (pin_cts == PIN_UNDEFINED) return (true); //CTS not implmented on this board
1616
if (settings.flowControl == false) return (true); //CTS turned off
17-
return (digitalRead(pin_cts) == HIGH) ^ settings.invertCts;
17+
//The SAMD21 specification (page 448) indicates that CTS is low when data is flowing
18+
return (digitalRead(pin_cts) == LOW) ^ settings.invertCts;
1819
}
1920

2021
#define NEXT_RX_TAIL(n) ((rxTail + n) % sizeof(serialReceiveBuffer))
@@ -80,7 +81,8 @@ void updateRTS(bool assertRTS)
8081
{
8182
rtsAsserted = assertRTS;
8283
if (settings.flowControl && (pin_rts != PIN_UNDEFINED))
83-
digitalWrite(pin_rts, assertRTS ^ settings.invertRts);
84+
//The SAMD21 specification (page 448) indicates that RTS is low to enable data flow
85+
digitalWrite(pin_rts, (assertRTS ? 0 : 1) ^ settings.invertRts);
8486
}
8587

8688
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

0 commit comments

Comments
 (0)