Skip to content

Commit

Permalink
Serial Interface configurable at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
alde103 committed Jun 30, 2021
1 parent d0a494f commit 39d152f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/RS485.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,9 @@ void RS485Class::setPins(int txPin, int dePin, int rePin)
_rePin = rePin;
}

void RS485Class::setSerial(HardwareSerial* hwSerial)
{
_serial = hwSerial;
}

RS485Class RS485(SERIAL_PORT_HARDWARE, RS485_DEFAULT_TX_PIN, RS485_DEFAULT_DE_PIN, RS485_DEFAULT_RE_PIN);
1 change: 1 addition & 0 deletions src/RS485.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class RS485Class : public Stream {
void sendBreakMicroseconds(unsigned int duration);

void setPins(int txPin, int dePin, int rePin);
void setSerial(HardwareSerial* hwSerial);

private:
HardwareSerial* _serial;
Expand Down

0 comments on commit 39d152f

Please sign in to comment.