Add stm32f7

This commit is contained in:
fvanroie 2021-09-17 16:50:00 +02:00
parent 40b622574d
commit 6192145f7c
5 changed files with 33 additions and 7 deletions

View File

@ -13,7 +13,7 @@
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#if !defined(ARDUINO_ARCH_ESP8266) && !defined(STM32F4xx)
#if !defined(ARDUINO_ARCH_ESP8266) && !defined(STM32F4xx) && !defined(STM32F7xx)
#include <dirent.h>
#endif
#ifdef WIN32

View File

@ -5,7 +5,7 @@
* INCLUDES
*********************/
#if !(defined(WINDOWS) || defined(POSIX))
#if !(defined(WINDOWS) || defined(POSIX) || defined(STM32F7xx))
#include <Arduino.h>
#include <stdio.h>

View File

@ -25,7 +25,7 @@
#elif defined(ARDUINO_ARCH_ESP32)
#include <WiFi.h>
#include <WiFiUdp.h>
#elif defined(STM32F4xx)
#elif defined(STM32F4xx) || defined(STM32F7xx)
#include <time.h>
#endif
@ -297,12 +297,13 @@ void debugStartSerial()
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
Serial.setRx(PA3); // User Serial2
Serial.setTx(PA2);
#endif
#endif
Serial.begin(baudrate); /* prepare for possible serial debug */
delay(10);
Log.registerOutput(0, &Serial, LOG_LEVEL_VERBOSE, true); // LOG_LEVEL_VERBOSE

View File

@ -6,7 +6,7 @@
#include "hasp_debug.h"
#include "hal/hasp_hal.h"
#if HASP_USE_ETHERNET > 0 && defined(STM32F4xx)
#if HASP_USE_ETHERNET > 0 && (defined(STM32F4xx) || defined(STM32F7xx))
EthernetClient EthClient;
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,
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

View File

@ -67,7 +67,7 @@ hasp_http_config_t http_config;
#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>
EthernetWebServer webServer(80);
#endif
@ -594,7 +594,7 @@ void webHandleInfoJson()
webSendPage(haspDevice.get_hostname(), htmldata.length(), false);
webServer.sendContent(htmldata);
htmldata.clear();
// htmldata.clear();
webSendFooter();
}