MCUdude / MegaCoreX

An Arduino hardware package for ATmega4809, ATmega4808, ATmega3209, ATmega3208, ATmega1609, ATmega1608, ATmega809 and ATmega808
GNU Lesser General Public License v2.1
239 stars 47 forks source link

Fix MegaCoreX library to support ArduinoModBus and ArduinoRS485 #198

Open DrItanium opened 3 months ago

DrItanium commented 3 months ago

This is a fix for #192 .

Arduino's modbus library is written assuming that the ArduinoCore-API is new enough that there is an arduino namespace. The version inside MegaCoreX is an older version of the api and does not have this. This pull request adds the minimal number of classes in the api to the arduino namespace to allow ArduinoModbus to compile.

The second change is related, the ArduinoRS485 library is written with the assumption that the macro SERIAL_PORT_HARDWARE is available from the board's variant header. This assumption was violated for the standard 28/32/40/48 pin variants. This pull request introduces these missing macros for libraries such as ArduinoRS485 so that they can compile successfully. I tried using what I viewed as sane defaults.