Skip to content

Commit

Permalink
rename esp platform to esp8266 platform and add stm32 to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
thelsing committed Sep 13, 2024
1 parent a510042 commit 5ef9c8c
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 31 deletions.
13 changes: 13 additions & 0 deletions examples/knx-demo/platformio-ci.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/knx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down Expand Up @@ -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]]
Expand Down
6 changes: 3 additions & 3 deletions src/knx/knx_facade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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::EspPlatform, Knx::Bau07B0> knx(buttonEvent);
Knx::KnxFacade<Knx::Esp8266Platform, Knx::Bau07B0> knx(buttonEvent);
#elif MASK_VERSION == 0x57B0
Knx::KnxFacade<Knx::EspPlatform, Knx::Bau57B0> knx(buttonEvent);
Knx::KnxFacade<Knx::Esp8266Platform, Knx::Bau57B0> knx(buttonEvent);
#elif MASK_VERSION == 0x091A
Knx::KnxFacade<Knx::EspPlatform, Knx::Bau091A> knx(buttonEvent);
Knx::KnxFacade<Knx::Esp8266Platform, Knx::Bau091A> knx(buttonEvent);
#else
#error "Mask version not supported on ARDUINO_ARCH_ESP8266"
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/knx/knx_facade.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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::EspPlatform, Knx::Bau07B0> knx;
extern Knx::KnxFacade<Knx::Esp8266Platform, Knx::Bau07B0> knx;
#elif MASK_VERSION == 0x57B0
extern Knx::KnxFacade<Knx::EspPlatform, Knx::Bau57B0> knx;
extern Knx::KnxFacade<Knx::Esp8266Platform, Knx::Bau57B0> knx;
#elif MASK_VERSION == 0x091A
extern Knx::KnxFacade<Knx::EspPlatform, Knx::Bau091A> knx;
extern Knx::KnxFacade<Knx::Esp8266Platform, Knx::Bau091A> knx;
#else
#error "Mask version not supported on ARDUINO_ARCH_ESP8266"
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifdef ARDUINO_ARCH_ESP8266
#include "esp_platform.h"
#include "esp8266_platform.h"


#include <user_interface.h>
Expand All @@ -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;
Expand All @@ -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());
Expand All @@ -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();

Expand All @@ -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");
Expand All @@ -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();

Expand All @@ -131,7 +131,7 @@ namespace Knx
return eepromptr;
}

void EspPlatform::commitToEeprom()
void Esp8266Platform::commitToEeprom()
{
EEPROM.commit();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/knx/platform/stm32_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "knx/bits.h"

#ifndef KNX_SERIAL
#define KNX_SERIAL Serial2
#define KNX_SERIAL Serial
#endif

namespace Knx
Expand Down

0 comments on commit 5ef9c8c

Please sign in to comment.