mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-16 07:46:33 +00:00
Fix STM32F4 environments
This commit is contained in:
parent
5072d1f1c3
commit
8ffd0ae23c
@ -44,7 +44,7 @@ typedef void (*printfunction)(uint8_t tag, int level, Print *);
|
||||
#define LOG_LEVEL_VERBOSE 7
|
||||
#define LOG_LEVEL_DEBUG 7
|
||||
|
||||
#define CR "\n"
|
||||
//#define CR "\n"
|
||||
#define LOGGING_VERSION 1_0_3
|
||||
|
||||
/**
|
||||
|
@ -7,6 +7,8 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
|
||||
#include "lv_drv_conf.h"
|
||||
|
||||
#if USE_FSMC_ILI9341 > 0
|
||||
|
||||
#include "fsmc_ili9341.h"
|
||||
|
@ -6,26 +6,28 @@
|
||||
#include "hasp_debug.h"
|
||||
#include "hasp_hal.h"
|
||||
|
||||
#if HASP_USE_ETHERNET > 0 && !defined(ARDUINO_ARCH_ESP32)
|
||||
#if HASP_USE_ETHERNET > 0 && defined(STM32F4xx)
|
||||
|
||||
EthernetClient EthClient;
|
||||
IPAddress ip;
|
||||
|
||||
void ethernetSetup()
|
||||
{
|
||||
#if USE_BUILTIN_ETHERNET > 0
|
||||
#if USE_BUILTIN_ETHERNET > 0
|
||||
// start Ethernet and UDP
|
||||
Log.notice(TAG_ETH, F("Begin Ethernet LAN8720"));
|
||||
if(Ethernet.begin() == 0) {
|
||||
Log.notice(TAG_ETH, F("Failed to configure Ethernet using DHCP"));
|
||||
eth_connected = false;
|
||||
} else {
|
||||
ip = Ethernet.localIP();
|
||||
Log.notice(TAG_ETH, F("DHCP Success got IP %d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]);
|
||||
eth_connected = true;
|
||||
}
|
||||
|
||||
Log.notice(TAG_ETH, F("MAC Address %s"), halGetMacAddress(0, ":"));
|
||||
|
||||
#else
|
||||
#else
|
||||
byte mac[6];
|
||||
uint32_t baseUID = (uint32_t)UID_BASE;
|
||||
mac[0] = 0x00;
|
||||
@ -49,7 +51,7 @@ void ethernetSetup()
|
||||
ip = Ethernet.localIP();
|
||||
Log.notice(TAG_ETH, F("DHCP Success got IP %d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void ethernetLoop(void)
|
||||
@ -86,13 +88,25 @@ void ethernetLoop(void)
|
||||
bool ethernetEvery5Seconds()
|
||||
{
|
||||
bool state;
|
||||
#if USE_BUILTIN_ETHERNET > 0
|
||||
#if USE_BUILTIN_ETHERNET > 0
|
||||
state = Ethernet.linkStatus() == LinkON;
|
||||
#else
|
||||
state = Ethernet.link() == 1;
|
||||
#endif
|
||||
#else
|
||||
state = Ethernet.link() == 1;
|
||||
#endif
|
||||
Log.warning(TAG_ETH, state ? F("ONLINE") : F("OFFLINE"));
|
||||
return state;
|
||||
}
|
||||
|
||||
void ethernet_get_statusupdate(char * buffer, size_t len)
|
||||
{
|
||||
#if USE_BUILTIN_ETHERNET > 0
|
||||
bool state = Ethernet.linkStatus() == LinkON;
|
||||
#else
|
||||
bool state = Ethernet.link() == 1;
|
||||
#endif
|
||||
|
||||
IPAddress ip = Ethernet.localIP();
|
||||
snprintf_P(buffer, len, PSTR("\"eth\":\"%s\",\"link\":%d,\"ip\":\"%d.%d.%d.%d\","), state ? F("ON") : F("OFF"), 10,
|
||||
ip[0], ip[1], ip[2], ip[3]);
|
||||
}
|
||||
#endif
|
@ -4,8 +4,12 @@
|
||||
#ifndef HASP_ETHERNET_STM32_H
|
||||
#define HASP_ETHERNET_STM32_H
|
||||
|
||||
static bool eth_connected = false;
|
||||
|
||||
void ethernetSetup();
|
||||
void ethernetLoop(void);
|
||||
|
||||
bool ethernetEvery5Seconds();
|
||||
void ethernet_get_statusupdate(char * buffer, size_t len);
|
||||
|
||||
#endif
|
@ -38,8 +38,8 @@ build_flags =
|
||||
-D ILI9341_DRIVER=1
|
||||
-D TFT_WIDTH=240
|
||||
-D TFT_HEIGHT=320
|
||||
-D USE_FSMC ; Use the onboard FSMC TFT header
|
||||
;-D USER_SETUP_LOADED=1
|
||||
-D USE_FSMC= ; Use the onboard FSMC TFT header
|
||||
;-D USER_SETUP_LOADED=1 ; TFT_eSPI is not used here
|
||||
;-D TOUCH_CS=PA6 ;NC
|
||||
;-D TFT_RST=-1 ;D4
|
||||
;-D STM32
|
||||
@ -76,11 +76,11 @@ build_flags =
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
${stm32f4.lib_deps}
|
||||
; STM32duino STM32Ethernet@^1.0.5
|
||||
https://github.com/stm32duino/STM32Ethernet.git
|
||||
https://github.com/khoih-prog/EthernetWebServer_STM32
|
||||
stm32duino/STM32Ethernet @ ^1.2.0
|
||||
;https://github.com/stm32duino/STM32Ethernet.git
|
||||
khoih-prog/EthernetWebServer_STM32 @ ^1.1.0
|
||||
adafruit/Adafruit GFX Library @ ^1.10.3
|
||||
;adafruit/Adafruit BusIO @ ^1.6.0
|
||||
adafruit/Adafruit BusIO @ ^1.6.0
|
||||
;https://github.com/ZinggJM/GxTFT.git
|
||||
XPT2046_Touchscreen
|
||||
|
||||
|
@ -71,9 +71,9 @@ build_flags =
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
${stm32f4.lib_deps}
|
||||
; STM32duino STM32Ethernet@^1.0.5
|
||||
https://github.com/stm32duino/STM32Ethernet.git
|
||||
https://github.com/khoih-prog/EthernetWebServer_STM32
|
||||
stm32duino/STM32Ethernet @ ^1.2.0
|
||||
; https://github.com/stm32duino/STM32Ethernet.git
|
||||
khoih-prog/EthernetWebServer_STM32 @ ^1.1.0
|
||||
|
||||
lib_ignore =
|
||||
GxTFT
|
||||
|
Loading…
x
Reference in New Issue
Block a user