CMB27 / ModbusRTUMaster

A library to implement the master/client portion of the Modbus RTU protocol on Arduino
MIT License
48 stars 7 forks source link

Compatibility with ESP Softwareserial library #2

Closed JayLu88 closed 1 year ago

JayLu88 commented 1 year ago

Hi,

Great work! Compact, Straight-forward and easy to understand.

I tried ModbusRTUMaster with the EspSoftwareSerial library:

https://github.com/plerup/espsoftwareserial https://www.arduino.cc/reference/en/libraries/espsoftwareserial/)

with something like the followings:

EspSoftwareSerial::UART my485Serial (Pin_SoftwareSerial_Rx, Pin_SoftwareSerial_Tx); ModbusRTUMaster modbus (my485Serial);

When compiling, the Aruido IDE will show an error: no matching function for call to 'ModbusRTUMaster::ModbusRTUMaster(EspSoftwareSerial::UART&)'

Is it possible to modify and add a new software serial type of EspSoftwareSerial::UART, besides SoftwareSerial and HardwareSerial?

Thanks!

CMB27 commented 1 year ago

Hello,

At this time, only HardwareSerial, SoftwareSerial, and Serial_ (USB serial on ATMega32u4 processors) are supported.

It is very much possible to modify the library to support additional serial object types. I am not willing to commit to making that happen for EspSoftwareSerial::UART at this time, however you are more than welcome to fork/copy this library and make the changes yourself.