mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
commit
41f2f991d3
@ -48,7 +48,7 @@
|
||||
#include "hasp_spiffs.h"
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
|
||||
#include "lv_zifont.h"
|
||||
// #include "lv_zifont.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -88,6 +88,10 @@
|
||||
#include "hasp_slave.h"
|
||||
#endif
|
||||
|
||||
#if HASP_USE_ETHERNET>0
|
||||
#include "hasp_ethernet.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef FPSTR
|
||||
|
@ -80,7 +80,7 @@ typedef int16_t lv_coord_t;
|
||||
# define LV_MEM_SIZE (12 * 1024U) // 12KB
|
||||
#endif
|
||||
#ifndef LV_MEM_SIZE
|
||||
# define LV_MEM_SIZE (64 * 1024U) // 48KB
|
||||
# define LV_MEM_SIZE (20 * 1024U) // 48KB
|
||||
#endif
|
||||
|
||||
/* Complier prefix for a big array declaration */
|
||||
|
@ -152,12 +152,62 @@ build_flags =
|
||||
-D HASP_OUTPUT_PIN=PE0 ; User LED D2 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 HAL_ETH_MODULE_ENABLED=1 ; enable ethernet support
|
||||
-D LAN8742A_PHY_ADDRESS=0x01U ; set LAN8720 PHY address
|
||||
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
Ticker@^3.1.5
|
||||
STM32duino LwIP@^2.1.2
|
||||
STM32duino STM32Ethernet@^1.0.5
|
||||
; STM32duino LwIP@^2.1.2
|
||||
; STM32duino STM32Ethernet@^1.0.5
|
||||
https://github.com/stm32duino/LwIP.git
|
||||
https://github.com/stm32duino/STM32Ethernet.git
|
||||
|
||||
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<lv_lib_zifont/> +<stm32f4/>
|
||||
|
||||
;***************************************************
|
||||
|
||||
[env:DevEBox_STM32F4xx]
|
||||
platform = ststm32
|
||||
board = black_f407zg
|
||||
board_build.mcu = stm32f407vgt6
|
||||
; upload_protocol = dfu
|
||||
upload_protocol = stlink
|
||||
debug_tool = stlink
|
||||
monitor_port = COM19 ; To change the port, use platform_override.ini
|
||||
build_flags =
|
||||
${env.build_flags}
|
||||
${flags.stm32_flags}
|
||||
-I include/stm32f4
|
||||
; -- TFT_eSPI build options ------------------------
|
||||
${lcd.lolin24}
|
||||
;-D TFT_MISO=PB4 ;Default
|
||||
;-D TFT_MOSI=PB5 ;Default
|
||||
;-D TFT_SCLK=PB3 ;Default
|
||||
-D TFT_CS=PE13 ;D8
|
||||
-D TFT_DC=PE14 ;D3
|
||||
-D TFT_BCKL=-1 ;None, configurable via web UI (e.g. 2 for D4)
|
||||
-D TOUCH_CS=PA6 ;NC
|
||||
-D TFT_RST=-1 ;D4
|
||||
-D STM32
|
||||
-D TFT_SPI3
|
||||
-D USE_DMA_TO_TFT
|
||||
-D HASP_USE_TASMOTA_SLAVE=1
|
||||
-D HASP_OUTPUT_PIN=PA1 ; User LED D2 on DevEBox board
|
||||
-D HASP_INPUT_PIN=PA0 ; 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 HASP_USE_ETHERNET=1
|
||||
-D HAL_ETH_MODULE_ENABLED=1
|
||||
-D LAN8742A_PHY_ADDRESS=0x01U
|
||||
; -D DP83848_PHY_ADDRESS=0x01U
|
||||
|
||||
lib_deps =
|
||||
${env.lib_deps}
|
||||
Ticker@^3.1.5
|
||||
; STM32duino LwIP@^2.1.2
|
||||
; STM32duino STM32Ethernet@^1.0.5
|
||||
https://github.com/stm32duino/LwIP.git
|
||||
https://github.com/stm32duino/STM32Ethernet.git
|
||||
|
||||
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/> -<lv_lib_zifont/> +<stm32f4/>
|
||||
|
||||
|
33
src/hasp_ethernet.cpp
Normal file
33
src/hasp_ethernet.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include <Arduino.h>
|
||||
#include "ArduinoJson.h"
|
||||
#include "ArduinoLog.h"
|
||||
#include "hasp_conf.h"
|
||||
|
||||
#if HASP_USE_ETHERNET>0
|
||||
|
||||
#include <LwIP.h>
|
||||
#include <STM32Ethernet.h>
|
||||
#include <EthernetUdp.h>
|
||||
|
||||
EthernetClient EthClient;
|
||||
|
||||
void ethernetSetup()
|
||||
{
|
||||
// start Ethernet and UDP
|
||||
Log.notice(F("ETH: Begin Ethernet"));
|
||||
|
||||
if (Ethernet.begin() == 0) {
|
||||
Log.notice(F("ETH: Failed to configure Ethernet using DHCP"));
|
||||
} else {
|
||||
IPAddress ip = Ethernet.localIP();
|
||||
Log.notice(F("ETH: DHCP Success got IP=%d.%d.%d.%d"),ip[0], ip[1], ip[2], ip[3]);
|
||||
}
|
||||
}
|
||||
|
||||
void ethernetLoop(void)
|
||||
{
|
||||
Ethernet.maintain();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
7
src/hasp_ethernet.h
Normal file
7
src/hasp_ethernet.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef HASP_ETHERNET_H
|
||||
#define HASP_ETHERNET_H
|
||||
|
||||
void ethernetSetup();
|
||||
void ethernetLoop(void);
|
||||
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#if HASP_USE_SLAVE>0
|
||||
#if HASP_USE_TASMOTA_SLAVE>0
|
||||
|
||||
#include "hasp_slave.h"
|
||||
#include <Arduino.h>
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "ArduinoJson.h"
|
||||
|
||||
#define HASP_SLAVE_SPEED 38400
|
||||
#define HASP_SLAVE_SPEED 57600
|
||||
|
||||
void TASMO_EVERY_SECOND(void);
|
||||
void TASMO_DATA_RECEIVE(char *data);
|
||||
|
@ -78,6 +78,10 @@ void setup()
|
||||
|
||||
#endif // WIFI
|
||||
|
||||
#if HASP_USE_ETHERNET
|
||||
ethernetSetup();
|
||||
#endif
|
||||
|
||||
#if HASP_USE_TASMOTA_SLAVE
|
||||
slaveSetup();
|
||||
#endif
|
||||
@ -139,6 +143,10 @@ void loop()
|
||||
|
||||
#endif // WIFI
|
||||
|
||||
#if HASP_USE_ETHERNET
|
||||
ethernetLoop();
|
||||
#endif
|
||||
|
||||
#if HASP_USE_TASMOTA_SLAVE
|
||||
slaveLoop();
|
||||
#endif // TASMOTASLAVE
|
||||
|
Loading…
x
Reference in New Issue
Block a user