mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-19 17:26:38 +00:00
Add stm32f7
This commit is contained in:
parent
40b622574d
commit
6192145f7c
@ -13,7 +13,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#if !defined(ARDUINO_ARCH_ESP8266) && !defined(STM32F4xx)
|
#if !defined(ARDUINO_ARCH_ESP8266) && !defined(STM32F4xx) && !defined(STM32F7xx)
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* INCLUDES
|
* INCLUDES
|
||||||
*********************/
|
*********************/
|
||||||
|
|
||||||
#if !(defined(WINDOWS) || defined(POSIX))
|
#if !(defined(WINDOWS) || defined(POSIX) || defined(STM32F7xx))
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#elif defined(ARDUINO_ARCH_ESP32)
|
#elif defined(ARDUINO_ARCH_ESP32)
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
#elif defined(STM32F4xx)
|
#elif defined(STM32F4xx) || defined(STM32F7xx)
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -297,12 +297,13 @@ void debugStartSerial()
|
|||||||
|
|
||||||
if(baudrate >= 9600u) { /* the baudrates are stored divided by 10 */
|
if(baudrate >= 9600u) { /* the baudrates are stored divided by 10 */
|
||||||
|
|
||||||
#if defined(STM32F4xx)
|
#if defined(STM32F4xx) || defined(STM32F7xx)
|
||||||
#ifndef STM32_SERIAL1 // Define what Serial port to use for log output
|
#ifndef STM32_SERIAL1 // Define what Serial port to use for log output
|
||||||
Serial.setRx(PA3); // User Serial2
|
Serial.setRx(PA3); // User Serial2
|
||||||
Serial.setTx(PA2);
|
Serial.setTx(PA2);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Serial.begin(baudrate); /* prepare for possible serial debug */
|
Serial.begin(baudrate); /* prepare for possible serial debug */
|
||||||
delay(10);
|
delay(10);
|
||||||
Log.registerOutput(0, &Serial, LOG_LEVEL_VERBOSE, true); // LOG_LEVEL_VERBOSE
|
Log.registerOutput(0, &Serial, LOG_LEVEL_VERBOSE, true); // LOG_LEVEL_VERBOSE
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "hasp_debug.h"
|
#include "hasp_debug.h"
|
||||||
#include "hal/hasp_hal.h"
|
#include "hal/hasp_hal.h"
|
||||||
|
|
||||||
#if HASP_USE_ETHERNET > 0 && defined(STM32F4xx)
|
#if HASP_USE_ETHERNET > 0 && (defined(STM32F4xx) || defined(STM32F7xx))
|
||||||
|
|
||||||
EthernetClient EthClient;
|
EthernetClient EthClient;
|
||||||
IPAddress ip;
|
IPAddress ip;
|
||||||
@ -109,4 +109,29 @@ void ethernet_get_statusupdate(char* buffer, size_t len)
|
|||||||
snprintf_P(buffer, len, PSTR("\"eth\":\"%s\",\"link\":%d,\"ip\":\"%d.%d.%d.%d\","), state ? F("on") : F("off"), 10,
|
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]);
|
ip[0], ip[1], ip[2], ip[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ethernet_get_info(JsonDocument& doc)
|
||||||
|
{
|
||||||
|
char size_buf[32];
|
||||||
|
String buffer((char*)0);
|
||||||
|
buffer.reserve(64);
|
||||||
|
|
||||||
|
JsonObject info = doc.createNestedObject(F(D_INFO_ETHERNET));
|
||||||
|
|
||||||
|
// buffer = Ethernet.linkSpeed();
|
||||||
|
// buffer += F(" Mbps");
|
||||||
|
// if(Ethernet.fullDuplex()) {
|
||||||
|
// buffer += F(" " D_INFO_FULL_DUPLEX);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// info[F(D_INFO_LINK_SPEED)] = buffer;
|
||||||
|
|
||||||
|
IPAddress ip = Ethernet.localIP();
|
||||||
|
snprintf_P(size_buf, sizeof(size_buf), PSTR("%d.%d.%d.%d"), ip[0], ip[1], ip[2], ip[3]);
|
||||||
|
info[F(D_INFO_IP_ADDRESS)] = size_buf;
|
||||||
|
// info[F(D_INFO_GATEWAY)] = Ethernet.gatewayIP().toString();
|
||||||
|
// info[F(D_INFO_DNS_SERVER)] = Ethernet.dnsIP().toString();
|
||||||
|
// info[F(D_INFO_MAC_ADDRESS)] = Ethernet.macAddress();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -67,7 +67,7 @@ hasp_http_config_t http_config;
|
|||||||
|
|
||||||
#define HTTP_PAGE_SIZE (6 * 256)
|
#define HTTP_PAGE_SIZE (6 * 256)
|
||||||
|
|
||||||
#if defined(STM32F4xx) && HASP_USE_ETHERNET > 0
|
#if(defined(STM32F4xx) || defined(STM32F7xx)) && HASP_USE_ETHERNET > 0
|
||||||
#include <EthernetWebServer_STM32.h>
|
#include <EthernetWebServer_STM32.h>
|
||||||
EthernetWebServer webServer(80);
|
EthernetWebServer webServer(80);
|
||||||
#endif
|
#endif
|
||||||
@ -594,7 +594,7 @@ void webHandleInfoJson()
|
|||||||
webSendPage(haspDevice.get_hostname(), htmldata.length(), false);
|
webSendPage(haspDevice.get_hostname(), htmldata.length(), false);
|
||||||
webServer.sendContent(htmldata);
|
webServer.sendContent(htmldata);
|
||||||
|
|
||||||
htmldata.clear();
|
// htmldata.clear();
|
||||||
webSendFooter();
|
webSendFooter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user