From d0b5e84526cf8a895f37884259de61f63aa29c32 Mon Sep 17 00:00:00 2001 From: Marco Scholl Date: Sat, 20 Jul 2024 23:47:58 +0200 Subject: [PATCH] remove generic ethernet support on rp2040. uses now KNX_IP_LAN or KNX_IP_WIFI --- src/rp2040_arduino_platform.cpp | 11 ++++------ src/rp2040_arduino_platform.h | 39 +++++---------------------------- 2 files changed, 9 insertions(+), 41 deletions(-) diff --git a/src/rp2040_arduino_platform.cpp b/src/rp2040_arduino_platform.cpp index 96c13c9..cbc745e 100644 --- a/src/rp2040_arduino_platform.cpp +++ b/src/rp2040_arduino_platform.cpp @@ -18,9 +18,8 @@ EEPROM Emulation from arduino-pico core (max 4k) can be use by defining USE_RP20 A RAM-buffered Flash can be use by defining USE_RP2040_LARGE_EEPROM_EMULATION For usage of KNX-IP you have to define either -- KNX_IP_W5500 (use the arduino-pico core's w5500 lwip stack) +- KNX_IP_LAN (use the arduino-pico core's w5500 lwip stack) - KNX_IP_WIFI (use the arduino-pico core's PiPicoW lwip stack) -- KNX_IP_GENERIC (use the Ethernet_Generic stack) ----------------------------------------------------*/ @@ -106,7 +105,7 @@ void __time_critical_func(uartDmaRestart)() #endif #endif -#ifdef KNX_IP_W5500 +#ifdef KNX_IP_LAN extern Wiznet5500lwIP KNX_NETIF; #elif defined(KNX_IP_WIFI) #elif defined(KNX_IP_GENERIC) @@ -462,13 +461,11 @@ uint32_t RP2040ArduinoPlatform::currentDefaultGateway() } void RP2040ArduinoPlatform::macAddress(uint8_t* addr) { -#if defined(KNX_IP_W5500) +#if defined(KNX_IP_LAN) addr = KNX_NETIF.getNetIf()->hwaddr; -#elif defined(KNX_IP_WIFI) +#else uint8_t macaddr[6] = {0, 0, 0, 0, 0, 0}; addr = KNX_NETIF.macAddress(macaddr); -#elif defined(KNX_IP_GENERIC) - KNX_NETIF.MACAddress(addr); #endif } diff --git a/src/rp2040_arduino_platform.h b/src/rp2040_arduino_platform.h index c02c2a7..bb756d0 100644 --- a/src/rp2040_arduino_platform.h +++ b/src/rp2040_arduino_platform.h @@ -22,40 +22,18 @@ #define KNX_SERIAL Serial1 #endif -#ifdef KNX_IP_W5500 -#if ARDUINO_PICO_MAJOR * 10000 + ARDUINO_PICO_MINOR * 100 + ARDUINO_PICO_REVISION < 30600 -#pragma error "arduino-pico >= 3.6.0 needed" +#ifdef KNX_IP_LAN +#if ARDUINO_PICO_MAJOR * 10000 + ARDUINO_PICO_MINOR * 100 + ARDUINO_PICO_REVISION < 30700 +#pragma error "arduino-pico >= 3.7.0 needed" #endif #define KNX_NETIF Eth #include "SPI.h" #include -#elif defined(KNX_IP_WIFI) - -#define KNX_NETIF WiFi +#else #include - -#elif defined(KNX_IP_GENERIC) - - -#include - -#ifndef DEBUG_ETHERNET_GENERIC_PORT -#define DEBUG_ETHERNET_GENERIC_PORT Serial -#endif - -#ifndef _ETG_LOGLEVEL_ -#define _ETG_LOGLEVEL_ 1 -#endif - - -#define ETHERNET_USE_RPIPICO true -#include // https://github.com/khoih-prog/Ethernet_Generic - - -#define KNX_NETIF Ethernet - +#define KNX_NETIF WiFi #endif #if USE_KNX_DMA_UART == 1 @@ -146,15 +124,8 @@ public: // unicast bool sendBytesUniCast(uint32_t addr, uint16_t port, uint8_t* buffer, uint16_t len) override; - #if defined(KNX_IP_W5500) || defined(KNX_IP_WIFI) #define UDP_UNICAST _udp protected: WiFiUDP _udp; - #elif defined(KNX_IP_GENERIC) - #define UDP_UNICAST _udp_uni - protected: bool _unicast_socket_setup = false; - protected: EthernetUDP _udp; - protected: EthernetUDP UDP_UNICAST; - #endif protected: IPAddress mcastaddr; protected: uint16_t _port; #endif