port to platformio
This commit is contained in:
42
src/BootOptions.cpp
Normal file
42
src/BootOptions.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "BootOptions.h"
|
||||
|
||||
#ifdef PLATFORM_PHOTON
|
||||
LEDStatus serialStatus = LEDStatus(RGB_COLOR_ORANGE, LED_PATTERN_FADE, LED_SPEED_FAST, LED_PRIORITY_BACKGROUND);
|
||||
LEDStatus configStatus = LEDStatus(RGB_COLOR_YELLOW, LED_PATTERN_FADE, LED_SPEED_NORMAL, LED_PRIORITY_IMPORTANT);
|
||||
retained bool LAST_BOOT_WAS_FLASH;
|
||||
retained bool LAST_BOOT_WAS_SERIAL;
|
||||
#endif
|
||||
|
||||
void
|
||||
BootOptions::initPins()
|
||||
{
|
||||
#ifdef PLATFORM_PHOTON
|
||||
pinMode(2, INPUT_PULLDOWN);
|
||||
pinMode(3, INPUT_PULLDOWN);
|
||||
pinMode(4, INPUT_PULLDOWN);
|
||||
#endif
|
||||
}
|
||||
|
||||
BootOptions::BootOptions()
|
||||
{
|
||||
#ifdef PLATFORM_PHOTON
|
||||
isSetup = digitalRead(2) == HIGH;
|
||||
isSerial = digitalRead(3) == HIGH || LAST_BOOT_WAS_SERIAL;
|
||||
isFlash = digitalRead(4) == HIGH;
|
||||
|
||||
LAST_BOOT_WAS_FLASH = isFlash;
|
||||
LAST_BOOT_WAS_SERIAL |= isSerial;
|
||||
lastBootWasFlash = LAST_BOOT_WAS_FLASH;
|
||||
|
||||
configStatus.setActive(isSetup);
|
||||
serialStatus.setActive(isSerial);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
BootOptions::waitForRelease()
|
||||
{
|
||||
#ifdef PLATFORM_PHOTON
|
||||
while(digitalRead(2) == HIGH || digitalRead(3) == HIGH) {};
|
||||
#endif
|
||||
}
|
Reference in New Issue
Block a user