remove generic ethernet support on rp2040. uses now KNX_IP_LAN or KNX_IP_WIFI

This commit is contained in:
Marco Scholl 2024-07-20 23:47:58 +02:00
parent 093ae425b0
commit d0b5e84526
No known key found for this signature in database
2 changed files with 9 additions and 41 deletions

View File

@ -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 A RAM-buffered Flash can be use by defining USE_RP2040_LARGE_EEPROM_EMULATION
For usage of KNX-IP you have to define either 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_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
#endif #endif
#ifdef KNX_IP_W5500 #ifdef KNX_IP_LAN
extern Wiznet5500lwIP KNX_NETIF; extern Wiznet5500lwIP KNX_NETIF;
#elif defined(KNX_IP_WIFI) #elif defined(KNX_IP_WIFI)
#elif defined(KNX_IP_GENERIC) #elif defined(KNX_IP_GENERIC)
@ -462,13 +461,11 @@ uint32_t RP2040ArduinoPlatform::currentDefaultGateway()
} }
void RP2040ArduinoPlatform::macAddress(uint8_t* addr) void RP2040ArduinoPlatform::macAddress(uint8_t* addr)
{ {
#if defined(KNX_IP_W5500) #if defined(KNX_IP_LAN)
addr = KNX_NETIF.getNetIf()->hwaddr; addr = KNX_NETIF.getNetIf()->hwaddr;
#elif defined(KNX_IP_WIFI) #else
uint8_t macaddr[6] = {0, 0, 0, 0, 0, 0}; uint8_t macaddr[6] = {0, 0, 0, 0, 0, 0};
addr = KNX_NETIF.macAddress(macaddr); addr = KNX_NETIF.macAddress(macaddr);
#elif defined(KNX_IP_GENERIC)
KNX_NETIF.MACAddress(addr);
#endif #endif
} }

View File

@ -22,40 +22,18 @@
#define KNX_SERIAL Serial1 #define KNX_SERIAL Serial1
#endif #endif
#ifdef KNX_IP_W5500 #ifdef KNX_IP_LAN
#if ARDUINO_PICO_MAJOR * 10000 + ARDUINO_PICO_MINOR * 100 + ARDUINO_PICO_REVISION < 30600 #if ARDUINO_PICO_MAJOR * 10000 + ARDUINO_PICO_MINOR * 100 + ARDUINO_PICO_REVISION < 30700
#pragma error "arduino-pico >= 3.6.0 needed" #pragma error "arduino-pico >= 3.7.0 needed"
#endif #endif
#define KNX_NETIF Eth #define KNX_NETIF Eth
#include "SPI.h" #include "SPI.h"
#include <W5500lwIP.h> #include <W5500lwIP.h>
#elif defined(KNX_IP_WIFI) #else
#define KNX_NETIF WiFi
#include <WiFi.h> #include <WiFi.h>
#define KNX_NETIF WiFi
#elif defined(KNX_IP_GENERIC)
#include <SPI.h>
#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 <Ethernet_Generic.hpp> // https://github.com/khoih-prog/Ethernet_Generic
#define KNX_NETIF Ethernet
#endif #endif
#if USE_KNX_DMA_UART == 1 #if USE_KNX_DMA_UART == 1
@ -146,15 +124,8 @@ public:
// unicast // unicast
bool sendBytesUniCast(uint32_t addr, uint16_t port, uint8_t* buffer, uint16_t len) override; 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 #define UDP_UNICAST _udp
protected: WiFiUDP _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: IPAddress mcastaddr;
protected: uint16_t _port; protected: uint16_t _port;
#endif #endif