mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Style sweep
This commit is contained in:
parent
f3891077d0
commit
ac08900d0f
@ -5,18 +5,18 @@
|
|||||||
#include "hasp_conf.h"
|
#include "hasp_conf.h"
|
||||||
|
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
#include <Esp.h>
|
#include <Esp.h>
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ESP32)
|
#if defined(ESP32)
|
||||||
#include <Esp.h>
|
#include <Esp.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
#include <rom/rtc.h> // needed to get the ResetInfo
|
#include <rom/rtc.h> // needed to get the ResetInfo
|
||||||
|
|
||||||
// Compatibility function for ESP8266 getRestInfo
|
// Compatibility function for ESP8266 getRestInfo
|
||||||
String esp32ResetReason(uint8_t cpuid)
|
String esp32ResetReason(uint8_t cpuid)
|
||||||
@ -152,11 +152,11 @@ String halGetChipModel()
|
|||||||
case CHIP_ESP32:
|
case CHIP_ESP32:
|
||||||
model += F("ESP32");
|
model += F("ESP32");
|
||||||
break;
|
break;
|
||||||
#ifdef CHIP_ESP32S2
|
#ifdef CHIP_ESP32S2
|
||||||
case CHIP_ESP32S2:
|
case CHIP_ESP32S2:
|
||||||
model += F("ESP32-S2");
|
model += F("ESP32-S2");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
model = F("Unknown ESP32");
|
model = F("Unknown ESP32");
|
||||||
}
|
}
|
||||||
@ -174,19 +174,19 @@ String halGetChipModel()
|
|||||||
/* Memory Management Functions */
|
/* Memory Management Functions */
|
||||||
|
|
||||||
#if defined(STM32F4xx)
|
#if defined(STM32F4xx)
|
||||||
#include <malloc.h> // for mallinfo()
|
#include <malloc.h> // for mallinfo()
|
||||||
#include <unistd.h> // for sbrk()
|
#include <unistd.h> // for sbrk()
|
||||||
|
|
||||||
int freeHighMemory()
|
int freeHighMemory()
|
||||||
{
|
{
|
||||||
char top;
|
char top;
|
||||||
#ifdef __arm__
|
#ifdef __arm__
|
||||||
return &top - reinterpret_cast<char *>(sbrk(0));
|
return &top - reinterpret_cast<char *>(sbrk(0));
|
||||||
#elif defined(CORE_TEENSY) || (ARDUINO > 103 && ARDUINO != 151)
|
#elif defined(CORE_TEENSY) || (ARDUINO > 103 && ARDUINO != 151)
|
||||||
return &top - __brkval;
|
return &top - __brkval;
|
||||||
#else // __arm__
|
#else // __arm__
|
||||||
return __brkval ? &top - __brkval : &top - __malloc_heap_start;
|
return __brkval ? &top - __brkval : &top - __malloc_heap_start;
|
||||||
#endif // __arm__
|
#endif // __arm__
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -260,14 +260,14 @@ String halGetMacAddress(int start, const char * seperator)
|
|||||||
|
|
||||||
#if defined(STM32F4xx)
|
#if defined(STM32F4xx)
|
||||||
uint8_t * mac_p = nullptr;
|
uint8_t * mac_p = nullptr;
|
||||||
#if HASP_USE_ETHERNET > 0
|
#if HASP_USE_ETHERNET > 0
|
||||||
#if USE_BUILTIN_ETHERNET > 0
|
#if USE_BUILTIN_ETHERNET > 0
|
||||||
mac_p = Ethernet.MACAddress();
|
mac_p = Ethernet.MACAddress();
|
||||||
for(int i = 0; i < 6; i++) mac[i] = *(mac_p + i);
|
for(int i = 0; i < 6; i++) mac[i] = *(mac_p + i);
|
||||||
#else
|
#else
|
||||||
Ethernet.macAddress(mac);
|
Ethernet.macAddress(mac);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
WiFi.macAddress(mac);
|
WiFi.macAddress(mac);
|
||||||
#endif
|
#endif
|
||||||
@ -348,7 +348,6 @@ String halDisplayDriverName()
|
|||||||
return F("Unknown");
|
return F("Unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String halGpioName(uint8_t gpio)
|
String halGpioName(uint8_t gpio)
|
||||||
{
|
{
|
||||||
#if defined(STM32F4xx)
|
#if defined(STM32F4xx)
|
||||||
@ -362,56 +361,56 @@ String halGpioName(uint8_t gpio)
|
|||||||
case PortName::PortB:
|
case PortName::PortB:
|
||||||
ioName = F("PB");
|
ioName = F("PB");
|
||||||
break;
|
break;
|
||||||
#if defined GPIOC_BASE
|
#if defined GPIOC_BASE
|
||||||
case PortName::PortC:
|
case PortName::PortC:
|
||||||
ioName = F("PC");
|
ioName = F("PC");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined GPIOD_BASE
|
#if defined GPIOD_BASE
|
||||||
case PortName::PortD:
|
case PortName::PortD:
|
||||||
ioName = F("PD");
|
ioName = F("PD");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined GPIOE_BASE
|
#if defined GPIOE_BASE
|
||||||
case PortName::PortE:
|
case PortName::PortE:
|
||||||
ioName = F("PE");
|
ioName = F("PE");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined GPIOF_BASE
|
#if defined GPIOF_BASE
|
||||||
case PortName::PortF:
|
case PortName::PortF:
|
||||||
ioName = F("PF");
|
ioName = F("PF");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined GPIOG_BASE
|
#if defined GPIOG_BASE
|
||||||
case PortName::PortG:
|
case PortName::PortG:
|
||||||
ioName = F("PG");
|
ioName = F("PG");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined GPIOH_BASE
|
#if defined GPIOH_BASE
|
||||||
case PortName::PortH:
|
case PortName::PortH:
|
||||||
ioName = F("PH");
|
ioName = F("PH");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined GPIOI_BASE
|
#if defined GPIOI_BASE
|
||||||
case PortName::PortI:
|
case PortName::PortI:
|
||||||
ioName = F("PI");
|
ioName = F("PI");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined GPIOJ_BASE
|
#if defined GPIOJ_BASE
|
||||||
case PortName::PortJ:
|
case PortName::PortJ:
|
||||||
ioName = F("PJ");
|
ioName = F("PJ");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined GPIOK_BASE
|
#if defined GPIOK_BASE
|
||||||
case PortName::PortK:
|
case PortName::PortK:
|
||||||
ioName = F("PK");
|
ioName = F("PK");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#if defined GPIOZ_BASE
|
#if defined GPIOZ_BASE
|
||||||
case PortName::PortZ:
|
case PortName::PortZ:
|
||||||
ioName = F("PZ");
|
ioName = F("PZ");
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
ioName = F("P?");
|
ioName = F("P?");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user