build: clean up the mess of ifdefs from platform into a scons-configured hal

This commit is contained in:
Torrie Fischer
2023-12-20 10:47:26 +01:00
parent 236795917a
commit 23993a09cf
21 changed files with 376 additions and 410 deletions

30
src/Hal.h Normal file
View File

@@ -0,0 +1,30 @@
#pragma once
struct BootOptions;
typedef enum {
HAL_UNKNOWN,
HAL_ESP32,
HAL_ESP8266
} HalBackend;
constexpr HalBackend DefaultBackend = HAL_ESP8266;
template<HalBackend Backend = DefaultBackend>
class PlatformImpl {
public:
static const char* name();
static const char* version();
static int freeRam();
static void startWatchdog();
static void startNTP();
static bool getLocalTime(struct tm* timedata, int timezone);
static void loop();
static const char* deviceID();
__attribute__((noreturn)) static void restart();
static void bootSplash();
static void printCrashInfo();
static void initBootOptions(BootOptions& opts);
static void forceSafeMode();
};