cleanup main.cpp, split platform code into a Platform object
This commit is contained in:
31
src/Platform.h
Normal file
31
src/Platform.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include <FastLED.h>
|
||||
#include "BootOptions.h"
|
||||
|
||||
class Platform {
|
||||
static int s_timezone;
|
||||
static char s_deviceID[15];
|
||||
public:
|
||||
static BootOptions bootopts;
|
||||
static void setTimezone(int tz) { s_timezone = tz; }
|
||||
static int getTimezone() { return s_timezone; }
|
||||
|
||||
static void addLEDs(CRGB* leds, unsigned int ledCount) {
|
||||
#ifdef PLATFORM_PHOTON
|
||||
FastLED.addLeds<NEOPIXEL, 6>(leds, ledCount);
|
||||
#elif defined(BOARD_ESP32)
|
||||
FastLED.addLeds<WS2812B, 13, RGB>(leds, ledCount);
|
||||
#else
|
||||
FastLED.addLeds<WS2812B, 14, GRB>(leds, ledCount);
|
||||
#endif
|
||||
}
|
||||
|
||||
static const char* name();
|
||||
static const char* version();
|
||||
static void preSetup();
|
||||
static void bootSplash();
|
||||
static void setup();
|
||||
static void loop();
|
||||
static bool getLocalTime(struct tm* timedata);
|
||||
static const char* deviceID();
|
||||
};
|
Reference in New Issue
Block a user