diff --git a/src/Arduboy.cpp b/src/Arduboy.cpp index d0c7938..001eb84 100644 --- a/src/Arduboy.cpp +++ b/src/Arduboy.cpp @@ -28,7 +28,6 @@ void Arduboy::begin() { boot(); // required bootUtils(); - bootLogo(); // Audio @@ -37,13 +36,9 @@ void Arduboy::begin() audio.begin(); } -// this is pusposely duplicated (without logo) so that -// whichever is actually used is linked and the one -// that is not is gone without wasting any space in flash -void Arduboy::beginNoLogo() +void Arduboy::beginMinimal() { boot(); // required - bootUtils(); // Audio tunes.initChannel(PIN_SPEAKER_1); @@ -51,14 +46,21 @@ void Arduboy::beginNoLogo() audio.begin(); } +void Arduboy::flashlight() +{ + // sendLCDCommand(OLED_ALL_PIXELS_ON); // smaller than allPixelsOn() + blank(); + setRGBled(255,255,255); + while(!pressed(DOWN_BUTTON)) { + idle(); + } + setRGBled(0,0,0); +} + void Arduboy::bootUtils() { - // flashlight if(pressed(UP_BUTTON)) { - // sendLCDCommand(OLED_ALL_PIXELS_ON); // smaller than allPixelsOn() - blank(); - setRGBled(255,255,255); - while(true) {} + flashlight(); } } diff --git a/src/Arduboy.h b/src/Arduboy.h index 27d6403..0c586a2 100644 --- a/src/Arduboy.h +++ b/src/Arduboy.h @@ -43,14 +43,23 @@ public: /// Initializes the hardware void begin(); - /// Initializes the hardware (but with no boot logo) - void beginNoLogo(); + /// Initializes the hardware (no logo, no other bootime niceities) + void beginMinimal(); void start() __attribute__ ((deprecated("use begin() instead"))); /// Scrolls in the Arduboy logo void bootLogo(); - /// Boot utils such as flashlight, etc + /// Flashlight mode + /** + * Hold up key when booting to enable, press down key to exit + * or simply turn off your Arduboy. Your sketches can also + * call this at any time. It goes into a tight loop until the + * down buttn is pressed. + */ + void flashlight(); + + /// Boot utility detection (such as flashlight, etc.) void inline bootUtils() __attribute__((always_inline)); /// Clears display.