From 4101e15a91526eed8f714057292a15da1c76b7b2 Mon Sep 17 00:00:00 2001 From: metaneutrons Date: Sat, 31 Aug 2019 09:58:45 +0200 Subject: [PATCH] added overload to platform constructors for custom HardwareSerial-object --- src/esp32_platform.cpp | 5 ++++- src/esp32_platform.h | 1 + src/esp_platform.cpp | 4 ++++ src/esp_platform.h | 1 + src/samd_platform.cpp | 4 ++++ src/samd_platform.h | 1 + 6 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/esp32_platform.cpp b/src/esp32_platform.cpp index 88b9add..eee0a24 100644 --- a/src/esp32_platform.cpp +++ b/src/esp32_platform.cpp @@ -6,11 +6,14 @@ #include "knx/bits.h" - Esp32Platform::Esp32Platform() : ArduinoPlatform(Serial) { } +Esp32Platform::Esp32Platform( HardwareSerial& s) : ArduinoPlatform(s) +{ +} + uint32_t Esp32Platform::currentIpAddress() { return WiFi.localIP(); diff --git a/src/esp32_platform.h b/src/esp32_platform.h index 3ecafba..79c0f96 100644 --- a/src/esp32_platform.h +++ b/src/esp32_platform.h @@ -11,6 +11,7 @@ class Esp32Platform : public ArduinoPlatform using ArduinoPlatform::_mulitcastPort; public: Esp32Platform(); + Esp32Platform( HardwareSerial& s); // ip stuff uint32_t currentIpAddress() override; diff --git a/src/esp_platform.cpp b/src/esp_platform.cpp index 71a121a..2ca2c5e 100644 --- a/src/esp_platform.cpp +++ b/src/esp_platform.cpp @@ -11,6 +11,10 @@ EspPlatform::EspPlatform() : ArduinoPlatform(Serial) { } +EspPlatform::EspPlatform( HardwareSerial& s) : ArduinoPlatform(s) +{ +} + uint32_t EspPlatform::currentIpAddress() { return WiFi.localIP(); diff --git a/src/esp_platform.h b/src/esp_platform.h index 75b2b21..a9b4670 100644 --- a/src/esp_platform.h +++ b/src/esp_platform.h @@ -12,6 +12,7 @@ class EspPlatform : public ArduinoPlatform public: EspPlatform(); + EspPlatform( HardwareSerial& s); // ip stuff uint32_t currentIpAddress() override; diff --git a/src/samd_platform.cpp b/src/samd_platform.cpp index 5fb8e42..31b1f03 100644 --- a/src/samd_platform.cpp +++ b/src/samd_platform.cpp @@ -10,6 +10,10 @@ SamdPlatform::SamdPlatform() : ArduinoPlatform(Serial1) { } +SamdPlatform::SamdPlatform( HardwareSerial& s) : ArduinoPlatform(s) +{ +} + void SamdPlatform::restart() { SerialDBG.println("restart"); diff --git a/src/samd_platform.h b/src/samd_platform.h index 4214e2d..7dbc70a 100644 --- a/src/samd_platform.h +++ b/src/samd_platform.h @@ -10,6 +10,7 @@ class SamdPlatform : public ArduinoPlatform { public: SamdPlatform(); + SamdPlatform( HardwareSerial& s); void restart(); uint8_t* getEepromBuffer(uint16_t size);