Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving CUSTOM_RS485_DEFAULT_DE_PIN and CUSTOM_RS485_DEFAULT_RE_PIN… #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/RS485.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@
#endif
#endif

#ifdef CUSTOM_RS485_DEFAULT_DE_PIN
#define RS485_DEFAULT_DE_PIN CUSTOM_RS485_DEFAULT_DE_PIN
#endif

#ifdef CUSTOM_RS485_DEFAULT_RE_PIN
#define RS485_DEFAULT_RE_PIN CUSTOM_RS485_DEFAULT_RE_PIN
#endif

#if !defined(RS485_DEFAULT_DE_PIN) && !defined(RS485_DEFAULT_RE_PIN)
#ifdef __AVR__
#define RS485_DEFAULT_DE_PIN 2
#define RS485_DEFAULT_RE_PIN -1
Expand All @@ -40,22 +49,16 @@
#define RS485_DEFAULT_DE_PIN A4
#define RS485_DEFAULT_RE_PIN A5
#elif defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_UNOR4_MINIMA)
#define SERIAL_PORT_HARDWARE Serial1
#define RS485_DEFAULT_DE_PIN 8
#define RS485_DEFAULT_RE_PIN 7
#else
#ifndef RS485_DEFAULT_DE_PIN
#define RS485_DEFAULT_DE_PIN A6
#define RS485_DEFAULT_RE_PIN A5
#endif
#endif

#ifdef CUSTOM_RS485_DEFAULT_DE_PIN
# define RS485_DEFAULT_DE_PIN CUSTOM_RS485_DEFAULT_DE_PIN
#endif

#ifdef CUSTOM_RS485_DEFAULT_RE_PIN
# define RS485_DEFAULT_RE_PIN CUSTOM_RS485_DEFAULT_RE_PIN
#if !defined(ARDUINO_UNOR4_WIFI) || !defined(ARDUINO_UNOR4_MINIMA)
#define SERIAL_PORT_HARDWARE Serial1
#endif

#define RS485_DEFAULT_PRE_DELAY 50
Expand Down