Skip to content

Commit

Permalink
v1.0.13
Browse files Browse the repository at this point in the history
* Fixed Mega 2560 compatibility issue.
  • Loading branch information
vishnumaiea committed Jun 30, 2024
1 parent e44a944 commit f953240
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 19 deletions.
7 changes: 7 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

Changelog for the `CSE_ArduinoRS485` library. Latest entries are at the top.

#
### **+05:30 08:31:31 PM 30-06-2024, Sunday**

* Added new platform/board checking preprocessor section to enable the SoftrwareSerial library. Some AVR boards like Mega 2560 have multiple harware serial ports and therefore shouldn't be using the SoftwareSerial library. The new changes fix this issue.
* The examples are compiling for Uno, Mega 2560 and ESP32 DevKit.
* New Revision `v1.0.13`.

#
### **+05:30 12:34:00 AM 21-05-2024, Tuesday**

Expand Down
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:repository-owner: CIRCUITSTATE
:repository-name: CSE_ArduinoRS485
:repository-version: 1.0.12
:repository-version: 1.0.13

image::https://socialify.git.ci/CIRCUITSTATE/CSE_ArduinoRS485/image?description=1&font=KoHo&forks=1&issues=1&logo=https%3A%2F%2Fwww.circuitstate.com%2Fwp-content%2Fuploads%2F2024%2F05%2FCIRCUITSTATE-R-Emblem-20052024-2.svg&name=1&pattern=Circuit%20Board&pulls=1&stargazers=1&theme=Auto[CSE_ArduinoRS485]

Expand Down
8 changes: 3 additions & 5 deletions examples/RS485_Receiver/RS485_Receiver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@

#include <CSE_ArduinoRS485.h>

// Declare the RS485 interface here with a hardware serial port.
// RS485Class RS485 (Serial1, 2, 3, 4); // DE, RE, TX
// If you want to use a software serial port, uncomment the following line.
// SoftwareSerial Serial1 (10, 11); // RX, TX

// If you want to use a software serial port, declare it here,
// comment out the previous declaration, and uncomment this section.
SoftwareSerial Serial1 (10, 11); // RX, TX
// For using Hardware serial ports, the following line is enough.
RS485Class RS485 (Serial1, 2, 3, 4); // DE, RE, TX

void setup() {
Expand Down
8 changes: 3 additions & 5 deletions examples/RS485_Sender/RS485_Sender.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@

int counter = 0;

// Declare the RS485 interface here with a hardware serial port.
// RS485Class RS485 (Serial1, 2, 3, 4); // DE, RE, TX

// If you want to use a software serial port, declare it here,
// comment out the previous declaration, and uncomment this section.
// If you want to use a software serial port, uncomment the following line.
SoftwareSerial Serial1 (10, 11); // RX, TX

// For using Hardware serial ports, the following line is enough.
RS485Class RS485 (Serial1, 2, 3, 4); // DE, RE, TX

void setup() {
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"url": "https://github.com/CIRCUITSTATE",
"maintainer": true
},
"version": "1.0.12",
"version": "1.0.13",
"license": "LGPL-2.1",
"frameworks": "arduino",
"platforms": "*"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=CSE_ArduinoRS485
version=1.0.12
version=1.0.13
author=CIRCUITSTATE
maintainer=CIRCUITSTATE <@circuitstate>
sentence=Allows sending and receiving data through the RS-485 interface, using any Arduino-compatible boards.
Expand Down
4 changes: 2 additions & 2 deletions src/CSE_RS485.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*/
//===================================================================================//

// Version: 1.0.12
// Last modified: +05:30 15:08:03 PM 28-01-2024, Sunday
// Version: 1.0.13
// Last modified: +05:30 21:11:24 PM 30-06-2024, Sunday
// Source: https://github.com/CIRCUITSTATE/CSE_ArduinoRS485

//===================================================================================//
Expand Down
44 changes: 40 additions & 4 deletions src/CSE_RS485.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*/
//===================================================================================//

// Version: 1.0.12
// Last modified: +05:30 15:03:34 PM 28-01-2024, Sunday
// Version: 1.0.13
// Last modified: +05:30 21:11:21 PM 30-06-2024, Sunday
// Source: https://github.com/CIRCUITSTATE/CSE_ArduinoRS485

//===================================================================================//
Expand All @@ -41,10 +41,46 @@
// You can expand the software serial support here.
// SoftwareSerial is required by boards like Arduino Uno and Nano which don't have a
// dedicated secondary hardware serial port.
#define SOFTWARE_SERIAL_REQUIRED defined(__AVR__) || defined(ARDUINO_ARCH_AVR) || defined(ESP8266)
// #define SOFTWARE_SERIAL_REQUIRED defined(__AVR__) || defined(ARDUINO_ARCH_AVR) || defined(ESP8266)

// #if !defined(HAVE_HWSERIAL1) && !defined(HAVE_HWSERIAL2) && !defined(HAVE_HWSERIAL3) && !defined(HAVE_HWSERIAL4)
// #define SOFTWARE_SERIAL_REQUIRED 1
// #endif

// // Check if the user has defined the macro to control SoftwareSerial inclusion
// #ifdef DISABLE_SOFTWARE_SERIAL
// #define SOFTWARE_SERIAL_REQUIRED 0
// #else
// #define SOFTWARE_SERIAL_REQUIRED 1
// #endif

// Define default values
#define _HAVE_HWSERIAL1

// Check for specific architectures and boards
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_NANO)
// Arduino Uno and Nano have only one hardware serial port
#define _HAVE_HWSERIAL1
#elif defined(ARDUINO_AVR_MEGA2560)
// Arduino Mega has four hardware serial ports
#define _HAVE_HWSERIAL1
#define _HAVE_HWSERIAL2
#define _HAVE_HWSERIAL3
#define _HAVE_HWSERIAL4
#elif defined(ARDUINO_ARCH_ESP32)
// ESP32 typically has three hardware serial ports
#define _HAVE_HWSERIAL1
#define _HAVE_HWSERIAL2
#define _HAVE_HWSERIAL3
#endif

// Define a flag to include SoftwareSerial if no additional UARTs are available
#if !defined(_HAVE_HWSERIAL2) && !defined(_HAVE_HWSERIAL3) && !defined(_HAVE_HWSERIAL4)
#define SOFTWARE_SERIAL_REQUIRED 1
#endif

// The SoftwareSerial is loaded automatically when required.
#if SOFTWARE_SERIAL_REQUIRED
#ifdef SOFTWARE_SERIAL_REQUIRED
#include <SoftwareSerial.h>
#endif

Expand Down

0 comments on commit f953240

Please sign in to comment.