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

Fix MegaCoreX library to support ArduinoModBus and ArduinoRS485 #198

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion megaavr/cores/coreX-corefiles/api/Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "IPAddress.h"
#include "Stream.h"

namespace arduino {
class Client : public Stream
{
public:
Expand All @@ -41,3 +41,6 @@ class Client : public Stream
protected:
uint8_t *rawIPAddress(IPAddress &addr) { return addr.raw_address(); };
};
}
using arduino::Client;

3 changes: 3 additions & 0 deletions megaavr/cores/coreX-corefiles/api/IPAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "Printable.h"
#include "String.h"

namespace arduino {
// A class to make it easier to handle and pass around IP addresses

class IPAddress : public Printable
Expand Down Expand Up @@ -75,3 +76,5 @@ class IPAddress : public Printable
};

extern const IPAddress INADDR_NONE;
}
using arduino::IPAddress;
5 changes: 4 additions & 1 deletion megaavr/cores/coreX-corefiles/api/Udp.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#include "Stream.h"
#include "IPAddress.h"

namespace arduino {
class UDP : public Stream
{
public:
Expand Down Expand Up @@ -84,3 +84,6 @@ class UDP : public Stream
protected:
uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); };
};
}

using arduino::UDP;
19 changes: 19 additions & 0 deletions megaavr/variants/28pin-standard/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,25 @@ const uint8_t digital_pin_to_timer[] = {

#endif

// These serial port names are intended to allow libraries and architecture-neutral
// sketches to automatically default to the correct port name for a particular type
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
//
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
//
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
//
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
//
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
//
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
// pins are NOT connected to anything by default.
#define SERIAL_PORT_MONITOR Serial
#define SERIAL_PORT_HARDWARE Serial1
#define SERIAL_PORT_HARDWARE_OPEN Serial2

void initVariant() __attribute__((weak));
void initVariant() { }

Expand Down
19 changes: 19 additions & 0 deletions megaavr/variants/32pin-standard/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,25 @@ const uint8_t digital_pin_to_timer[] = {

#endif

// These serial port names are intended to allow libraries and architecture-neutral
// sketches to automatically default to the correct port name for a particular type
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
//
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
//
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
//
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
//
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
//
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
// pins are NOT connected to anything by default.
#define SERIAL_PORT_MONITOR Serial
#define SERIAL_PORT_HARDWARE Serial1
#define SERIAL_PORT_HARDWARE_OPEN Serial2

void initVariant() __attribute__((weak));
void initVariant() { }

Expand Down
20 changes: 20 additions & 0 deletions megaavr/variants/40pin-standard/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,26 @@ const uint8_t digital_pin_to_timer[] = {

#endif

// These serial port names are intended to allow libraries and architecture-neutral
// sketches to automatically default to the correct port name for a particular type
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
//
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
//
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
//
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
//
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
//
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
// pins are NOT connected to anything by default.
#define SERIAL_PORT_MONITOR Serial
#define SERIAL_PORT_HARDWARE Serial1
#define SERIAL_PORT_HARDWARE_OPEN Serial2


void initVariant() __attribute__((weak));
void initVariant()
{
Expand Down
20 changes: 20 additions & 0 deletions megaavr/variants/48pin-standard/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,26 @@ const uint8_t digital_pin_to_timer[] = {

#endif

// These serial port names are intended to allow libraries and architecture-neutral
// sketches to automatically default to the correct port name for a particular type
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
//
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
//
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
//
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
//
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
//
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
// pins are NOT connected to anything by default.
#define SERIAL_PORT_MONITOR Serial
#define SERIAL_PORT_HARDWARE Serial1
#define SERIAL_PORT_HARDWARE_OPEN Serial2
#define SERIAL_PORT_HARDWARE_OPEN2 Serial3

void initVariant() __attribute__((weak));
void initVariant() { }

Expand Down