mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Add W5500 support
This commit is contained in:
parent
34cfd1cb94
commit
313d938968
@ -35,7 +35,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HASP_USE_SYSLOG
|
#ifndef HASP_USE_SYSLOG
|
||||||
#define HASP_USE_SYSLOG (HASP_HAS_NETWORK)
|
#define HASP_USE_SYSLOG 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HASP_USE_TELNET
|
#ifndef HASP_USE_TELNET
|
||||||
@ -94,7 +94,7 @@
|
|||||||
#include "hasp_spiffs.h"
|
#include "hasp_spiffs.h"
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
||||||
#include "lv_zifont.h"
|
//#include "lv_zifont.h"
|
||||||
#endif
|
#endif
|
||||||
#endif // SPIFFS
|
#endif // SPIFFS
|
||||||
|
|
||||||
@ -107,6 +107,19 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HASP_USE_ETHERNET>0
|
#if HASP_USE_ETHERNET>0
|
||||||
|
#if USE_BUILTIN_ETHERNET>0
|
||||||
|
#include <LwIP.h>
|
||||||
|
#include <STM32Ethernet.h>
|
||||||
|
#warning Use built-in STM32 Ethernet
|
||||||
|
#elif USE_UIP_ETHERNET
|
||||||
|
#include <UIPEthernet.h>
|
||||||
|
#include <utility/logging.h>
|
||||||
|
#warning Use ENC28J60 Ethernet shield
|
||||||
|
#else
|
||||||
|
#include "Ethernet.h"
|
||||||
|
#include "EthernetClient.h"
|
||||||
|
#warning Use W5x00 Ethernet shield
|
||||||
|
#endif
|
||||||
#include "hasp_ethernet.h"
|
#include "hasp_ethernet.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* Include the normal default core configuration */
|
/* Include the normal default core configuration */
|
||||||
#include "stm32f4xx_hal_conf_default.h"
|
#include "stm32f4xx_hal_conf_default.h"
|
||||||
|
|
||||||
|
#if USE_BUILTIN_ETHERNET
|
||||||
/* Remove the default PHY address */
|
/* Remove the default PHY address */
|
||||||
#ifdef LAN8742A_PHY_ADDRESS
|
#ifdef LAN8742A_PHY_ADDRESS
|
||||||
#undef LAN8742A_PHY_ADDRESS
|
#undef LAN8742A_PHY_ADDRESS
|
||||||
@ -10,4 +11,6 @@
|
|||||||
/* Redefine LAN8742A PHY Address*/
|
/* Redefine LAN8742A PHY Address*/
|
||||||
#ifndef LAN8742A_PHY_ADDRESS
|
#ifndef LAN8742A_PHY_ADDRESS
|
||||||
#define LAN8742A_PHY_ADDRESS 0x01U //HASP_PHY_ADDRESS
|
#define LAN8742A_PHY_ADDRESS 0x01U //HASP_PHY_ADDRESS
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -5,15 +5,7 @@
|
|||||||
|
|
||||||
#if HASP_USE_ETHERNET > 0
|
#if HASP_USE_ETHERNET > 0
|
||||||
|
|
||||||
#if defined(W5500_MOSI) && defined(W5500_MISO) && defined(W5500_SCLK)
|
|
||||||
#define W5500_LAN
|
|
||||||
#include <SPI.h>
|
|
||||||
#include <Ethernet3.h>
|
|
||||||
#else
|
|
||||||
#include <LwIP.h>
|
|
||||||
#include <STM32Ethernet.h>
|
|
||||||
#include <EthernetUdp.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
EthernetClient EthClient;
|
EthernetClient EthClient;
|
||||||
IPAddress ip;
|
IPAddress ip;
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#if defined(STM32F4xx)
|
|
||||||
#include <Stm32Ethernet.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "hasp_hal.h"
|
#include "hasp_hal.h"
|
||||||
|
#include "hasp_conf.h"
|
||||||
|
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
#include <ESP.h>
|
#include <ESP.h>
|
||||||
@ -250,7 +247,7 @@ String halGetMacAddress(int start, const char * seperator)
|
|||||||
|
|
||||||
#if defined(STM32F4xx)
|
#if defined(STM32F4xx)
|
||||||
uint8_t * mac_p;
|
uint8_t * mac_p;
|
||||||
mac_p = Ethernet.MACAddress();
|
//mac_p = Ethernet.MACAddress();
|
||||||
for(uint8_t i = 0; i < 6; i++) mac[i] = *(mac_p + i);
|
for(uint8_t i = 0; i < 6; i++) mac[i] = *(mac_p + i);
|
||||||
#else
|
#else
|
||||||
WiFi.macAddress(mac);
|
WiFi.macAddress(mac);
|
||||||
|
@ -18,7 +18,14 @@ WiFiClient mqttNetworkClient;
|
|||||||
#include <ESP.h>
|
#include <ESP.h>
|
||||||
WiFiClient mqttNetworkClient;
|
WiFiClient mqttNetworkClient;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#if defined(W5500_MOSI) && defined(W5500_MISO) && defined(W5500_SCLK)
|
||||||
|
#define W5500_LAN
|
||||||
|
#include <Ethernet.h>
|
||||||
|
#else
|
||||||
#include <STM32Ethernet.h>
|
#include <STM32Ethernet.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
EthernetClient mqttNetworkClient;
|
EthernetClient mqttNetworkClient;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "hasp_config.h"
|
#include "hasp_config.h"
|
||||||
#include "hasp_dispatch.h"
|
#include "hasp_dispatch.h"
|
||||||
#include "hasp_telnet.h"
|
#include "hasp_telnet.h"
|
||||||
|
#include "hasp_conf.h"
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
#include <Wifi.h>
|
#include <Wifi.h>
|
||||||
@ -19,7 +20,7 @@ static WiFiServer * telnetServer;
|
|||||||
WiFiClient telnetClient;
|
WiFiClient telnetClient;
|
||||||
static WiFiServer * telnetServer;
|
static WiFiServer * telnetServer;
|
||||||
#else
|
#else
|
||||||
#include <STM32Ethernet.h>
|
//#include <STM32Ethernet.h>
|
||||||
EthernetClient telnetClient;
|
EthernetClient telnetClient;
|
||||||
static EthernetServer telnetServer(23);
|
static EthernetServer telnetServer(23);
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,10 +9,6 @@
|
|||||||
#include "hasp_oobe.h"
|
#include "hasp_oobe.h"
|
||||||
#include "hasp_gpio.h"
|
#include "hasp_gpio.h"
|
||||||
|
|
||||||
#if HASP_USE_ETHERNET > 0
|
|
||||||
#include <STM32Ethernet.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool isConnected;
|
bool isConnected;
|
||||||
uint8_t mainLoopCounter = 0;
|
uint8_t mainLoopCounter = 0;
|
||||||
unsigned long mainLastLoopTime = 0;
|
unsigned long mainLastLoopTime = 0;
|
||||||
|
@ -28,17 +28,24 @@ build_flags =
|
|||||||
-D HASP_OUTPUT_PIN=PE0 ; User LED D2 on DevEBox board
|
-D HASP_OUTPUT_PIN=PE0 ; User LED D2 on DevEBox board
|
||||||
-D HASP_INPUT_PIN=PD15 ; User Button K1 on DevEBox board
|
-D HASP_INPUT_PIN=PD15 ; User Button K1 on DevEBox board
|
||||||
-D STM32_SERIAL1 ; Set this option to use Serial1 as default sersial port, leave out if using Serial2
|
-D STM32_SERIAL1 ; Set this option to use Serial1 as default sersial port, leave out if using Serial2
|
||||||
-D HAL_ETH_MODULE_ENABLED=1 ; enable ethernet support
|
;-D HAL_ETH_MODULE_ENABLED=1 ; enable ethernet support
|
||||||
-D LAN8742A_PHY_ADDRESS=0x01U ; set LAN8720 PHY address
|
;-D LAN8742A_PHY_ADDRESS=0x01U ; set LAN8720 PHY address
|
||||||
-D HASP_USE_TASMOTA_SLAVE=1
|
-D HASP_USE_TASMOTA_SLAVE=1
|
||||||
|
-D W5500_MOSI=PB15 ;SPI2 MOSI
|
||||||
|
-D W5500_MISO=PB14 ;SPI2 MISO
|
||||||
|
-D W5500_SCLK=PB13 ;SPI2 SCLK
|
||||||
|
-D W5500_CS=PB6 ;SPI2 CS
|
||||||
|
-D W5500_RST=PD1 ;SPI2 CS
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${env.lib_deps}
|
${env.lib_deps}
|
||||||
Ticker@^3.1.5
|
Ticker@^3.1.5
|
||||||
|
Ethernet
|
||||||
; STM32duino LwIP@^2.1.2
|
; STM32duino LwIP@^2.1.2
|
||||||
; STM32duino STM32Ethernet@^1.0.5
|
; STM32duino STM32Ethernet@^1.0.5
|
||||||
https://github.com/stm32duino/LwIP.git
|
https://github.com/stm32duino/LwIP.git
|
||||||
https://github.com/stm32duino/STM32Ethernet.git
|
;https://github.com/netwizeBE/Ethernet3.git
|
||||||
|
https://github.com/khoih-prog/EthernetWebServer_STM32
|
||||||
|
|
||||||
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<lv_lib_zifont/> +<stm32f4/>
|
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<lv_lib_zifont/> +<stm32f4/>
|
||||||
|
|
||||||
|
@ -47,5 +47,6 @@ lib_deps =
|
|||||||
; STM32duino STM32Ethernet@^1.0.5
|
; STM32duino STM32Ethernet@^1.0.5
|
||||||
https://github.com/stm32duino/LwIP.git
|
https://github.com/stm32duino/LwIP.git
|
||||||
https://github.com/stm32duino/STM32Ethernet.git
|
https://github.com/stm32duino/STM32Ethernet.git
|
||||||
|
https://github.com/khoih-prog/EthernetWebServer_STM32
|
||||||
|
|
||||||
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<lv_lib_zifont/> +<stm32f4/>
|
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<lv_lib_zifont/> +<stm32f4/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user