From 5ef9c8c04026a8be6abf1d01ef614fcf3ff793d2 Mon Sep 17 00:00:00 2001 From: Thomas Kunze Date: Fri, 13 Sep 2024 18:06:52 +0200 Subject: [PATCH] rename esp platform to esp8266 platform and add stm32 to ci --- examples/knx-demo/platformio-ci.ini | 13 ++++++++ src/knx.h | 8 ++--- src/knx/knx_facade.cpp | 6 ++-- src/knx/knx_facade.h | 8 ++--- ...{esp_platform.cpp => esp8266_platform.cpp} | 32 +++++++++---------- .../{esp_platform.h => esp8266_platform.h} | 6 ++-- src/knx/platform/stm32_platform.cpp | 2 +- 7 files changed, 44 insertions(+), 31 deletions(-) rename src/knx/platform/{esp_platform.cpp => esp8266_platform.cpp} (68%) rename src/knx/platform/{esp_platform.h => esp8266_platform.h} (90%) diff --git a/examples/knx-demo/platformio-ci.ini b/examples/knx-demo/platformio-ci.ini index c114346..bf3b133 100644 --- a/examples/knx-demo/platformio-ci.ini +++ b/examples/knx-demo/platformio-ci.ini @@ -40,6 +40,19 @@ build_flags = -DKNX_NO_SPI=1 -Wno-unknown-pragmas +;--- STM32 ----------------------------------------------- +[env:adafruit_feather_f405] +platform = ststm32 +board = adafruit_feather_f405 +framework = arduino +lib_deps = + knx + +build_flags = + -DMASK_VERSION=0x07B0 + -Wno-unknown-pragmas + -DUSE_DATASECURE + ;--- ESP8266 ----------------------------------------------- [env:nodemcuv2_ip] platform = espressif8266 diff --git a/src/knx.h b/src/knx.h index 49a9106..1d69201 100644 --- a/src/knx.h +++ b/src/knx.h @@ -122,8 +122,8 @@ class Samd51Platform [[class_samd51_platform.html]] Platform<|--ArduinoPlatform ArduinoPlatform<|--Samd21Platform ArduinoPlatform<|--Samd51Platform -class EspPlatform [[class_esp_platform.html]] -ArduinoPlatform<|--EspPlatform +class Esp8266Platform [[class_esp8266_platform.html]] +ArduinoPlatform<|--Esp8266Platform class Esp32Platform [[class_esp32_platform.html]] ArduinoPlatform<|--Esp32Platform class Stm32Platform [[class_stm32_platform.html]] @@ -226,8 +226,8 @@ class Samd51Platform [[class_samd51_platform.html]] Platform<|--ArduinoPlatform ArduinoPlatform<|--Samd21Platform ArduinoPlatform<|--Samd51Platform -class EspPlatform [[class_esp_platform.html]] -ArduinoPlatform<|--EspPlatform +class Esp8266Platform [[class_esp8266_platform.html]] +ArduinoPlatform<|--Esp8266Platform class Esp32Platform [[class_esp32_platform.html]] ArduinoPlatform<|--Esp32Platform class Stm32Platform [[class_stm32_platform.html]] diff --git a/src/knx/knx_facade.cpp b/src/knx/knx_facade.cpp index 9f2eb4e..9437462 100644 --- a/src/knx/knx_facade.cpp +++ b/src/knx/knx_facade.cpp @@ -85,11 +85,11 @@ ICACHE_RAM_ATTR void buttonEvent() #elif defined(ARDUINO_ARCH_ESP8266) // predefined global instance for TP or IP or TP/IP coupler #if MASK_VERSION == 0x07B0 - Knx::KnxFacade knx(buttonEvent); + Knx::KnxFacade knx(buttonEvent); #elif MASK_VERSION == 0x57B0 - Knx::KnxFacade knx(buttonEvent); + Knx::KnxFacade knx(buttonEvent); #elif MASK_VERSION == 0x091A - Knx::KnxFacade knx(buttonEvent); + Knx::KnxFacade knx(buttonEvent); #else #error "Mask version not supported on ARDUINO_ARCH_ESP8266" #endif diff --git a/src/knx/knx_facade.h b/src/knx/knx_facade.h index 509939b..8ada762 100644 --- a/src/knx/knx_facade.h +++ b/src/knx/knx_facade.h @@ -21,7 +21,7 @@ #elif defined(ARDUINO_ARCH_RP2040) #include "platform/rp2040_arduino_platform.h" #elif defined(ARDUINO_ARCH_ESP8266) -#include "platform/esp_platform.h" +#include "platform/esp8266_platform.h" #elif defined(ARDUINO_ARCH_ESP32) #include "platform/esp32_platform.h" #elif defined(ARDUINO_ARCH_STM32) @@ -504,11 +504,11 @@ namespace Knx #elif defined(ARDUINO_ARCH_ESP8266) // predefined global instance for TP or IP or TP/IP coupler #if MASK_VERSION == 0x07B0 - extern Knx::KnxFacade knx; + extern Knx::KnxFacade knx; #elif MASK_VERSION == 0x57B0 - extern Knx::KnxFacade knx; + extern Knx::KnxFacade knx; #elif MASK_VERSION == 0x091A - extern Knx::KnxFacade knx; + extern Knx::KnxFacade knx; #else #error "Mask version not supported on ARDUINO_ARCH_ESP8266" #endif diff --git a/src/knx/platform/esp_platform.cpp b/src/knx/platform/esp8266_platform.cpp similarity index 68% rename from src/knx/platform/esp_platform.cpp rename to src/knx/platform/esp8266_platform.cpp index 5eb705b..4deac55 100644 --- a/src/knx/platform/esp_platform.cpp +++ b/src/knx/platform/esp8266_platform.cpp @@ -1,5 +1,5 @@ #ifdef ARDUINO_ARCH_ESP8266 -#include "esp_platform.h" +#include "esp8266_platform.h" #include @@ -14,49 +14,49 @@ namespace Knx { - EspPlatform::EspPlatform() + Esp8266Platform::Esp8266Platform() #ifndef KNX_NO_DEFAULT_UART : ArduinoPlatform(&KNX_SERIAL) #endif { } - EspPlatform::EspPlatform( HardwareSerial* s) : ArduinoPlatform(s) + Esp8266Platform::Esp8266Platform( HardwareSerial* s) : ArduinoPlatform(s) { } - uint32_t EspPlatform::currentIpAddress() + uint32_t Esp8266Platform::currentIpAddress() { return WiFi.localIP(); } - uint32_t EspPlatform::currentSubnetMask() + uint32_t Esp8266Platform::currentSubnetMask() { return WiFi.subnetMask(); } - uint32_t EspPlatform::currentDefaultGateway() + uint32_t Esp8266Platform::currentDefaultGateway() { return WiFi.gatewayIP(); } - void EspPlatform::macAddress(uint8_t* addr) + void Esp8266Platform::macAddress(uint8_t* addr) { wifi_get_macaddr(STATION_IF, addr); } - uint32_t EspPlatform::uniqueSerialNumber() + uint32_t Esp8266Platform::uniqueSerialNumber() { return ESP.getChipId(); } - void EspPlatform::restart() + void Esp8266Platform::restart() { println("restart"); ESP.reset(); } - void EspPlatform::setupMultiCast(uint32_t addr, uint16_t port) + void Esp8266Platform::setupMultiCast(uint32_t addr, uint16_t port) { _multicastAddr = htonl(addr); _multicastPort = port; @@ -68,12 +68,12 @@ namespace Knx KNX_DEBUG_SERIAL.printf("result %d\n", result); } - void EspPlatform::closeMultiCast() + void Esp8266Platform::closeMultiCast() { _udp.stop(); } - bool EspPlatform::sendBytesMultiCast(uint8_t* buffer, uint16_t len) + bool Esp8266Platform::sendBytesMultiCast(uint8_t* buffer, uint16_t len) { //printHex("<- ",buffer, len); _udp.beginPacketMulticast(_multicastAddr, _multicastPort, WiFi.localIP()); @@ -82,7 +82,7 @@ namespace Knx return true; } - int EspPlatform::readBytesMultiCast(uint8_t* buffer, uint16_t maxLen) + int Esp8266Platform::readBytesMultiCast(uint8_t* buffer, uint16_t maxLen) { int len = _udp.parsePacket(); @@ -100,7 +100,7 @@ namespace Knx return len; } - bool EspPlatform::sendBytesUniCast(uint32_t addr, uint16_t port, uint8_t* buffer, uint16_t len) + bool Esp8266Platform::sendBytesUniCast(uint32_t addr, uint16_t port, uint8_t* buffer, uint16_t len) { IPAddress ucastaddr(htonl(addr)); println("sendBytesUniCast endPacket fail"); @@ -118,7 +118,7 @@ namespace Knx return true; } - uint8_t* EspPlatform::getEepromBuffer(uint32_t size) + uint8_t* Esp8266Platform::getEepromBuffer(uint32_t size) { uint8_t* eepromptr = EEPROM.getDataPtr(); @@ -131,7 +131,7 @@ namespace Knx return eepromptr; } - void EspPlatform::commitToEeprom() + void Esp8266Platform::commitToEeprom() { EEPROM.commit(); } diff --git a/src/knx/platform/esp_platform.h b/src/knx/platform/esp8266_platform.h similarity index 90% rename from src/knx/platform/esp_platform.h rename to src/knx/platform/esp8266_platform.h index a6d665a..50616d5 100644 --- a/src/knx/platform/esp_platform.h +++ b/src/knx/platform/esp8266_platform.h @@ -5,11 +5,11 @@ namespace Knx { - class EspPlatform : public ArduinoPlatform + class Esp8266Platform : public ArduinoPlatform { public: - EspPlatform(); - EspPlatform(HardwareSerial* s); + Esp8266Platform(); + Esp8266Platform(HardwareSerial* s); // ip stuff uint32_t currentIpAddress() override; diff --git a/src/knx/platform/stm32_platform.cpp b/src/knx/platform/stm32_platform.cpp index 0cb0001..cc99af2 100644 --- a/src/knx/platform/stm32_platform.cpp +++ b/src/knx/platform/stm32_platform.cpp @@ -5,7 +5,7 @@ #include "knx/bits.h" #ifndef KNX_SERIAL - #define KNX_SERIAL Serial2 + #define KNX_SERIAL Serial #endif namespace Knx