Skip to content

Commit 466aef0

Browse files
committed
Add pin configuration according to default core defines
1 parent 469e2f4 commit 466aef0

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Diff for: src/RS485.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,8 @@ void RS485Class::setDelays(int predelay, int postdelay)
186186
_postdelay = postdelay;
187187
}
188188

189+
#ifdef RS285_SERIAL_PORT
190+
RS485Class RS485(RS285_SERIAL_PORT, RS485_DEFAULT_TX_PIN, RS485_DEFAULT_DE_PIN, RS485_DEFAULT_RE_PIN);
191+
#else
189192
RS485Class RS485(SERIAL_PORT_HARDWARE, RS485_DEFAULT_TX_PIN, RS485_DEFAULT_DE_PIN, RS485_DEFAULT_RE_PIN);
193+
#endif

Diff for: src/RS485.h

+4
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@
2222

2323
#include <Arduino.h>
2424

25+
#ifndef RS485_DEFAULT_TX_PIN
2526
#ifdef PIN_SERIAL1_TX
2627
#define RS485_DEFAULT_TX_PIN PIN_SERIAL1_TX
2728
#else
2829
#define RS485_DEFAULT_TX_PIN 1
2930
#endif
31+
#endif
3032

3133
#ifdef __AVR__
3234
#define RS485_DEFAULT_DE_PIN 2
@@ -35,9 +37,11 @@
3537
#define RS485_DEFAULT_DE_PIN A1
3638
#define RS485_DEFAULT_RE_PIN A0
3739
#else
40+
#ifndef RS485_DEFAULT_DE_PIN
3841
#define RS485_DEFAULT_DE_PIN A6
3942
#define RS485_DEFAULT_RE_PIN A5
4043
#endif
44+
#endif
4145

4246

4347
#define RS485_DEFAULT_PRE_DELAY 50

0 commit comments

Comments
 (0)