minimal boot mode to save flash space

This commit is contained in:
Josh Goebel 2016-02-20 14:43:36 -05:00 committed by Scott Allen
parent 1e95b4edfe
commit eb5fb39e28
2 changed files with 25 additions and 14 deletions

View File

@ -28,7 +28,6 @@ void Arduboy::begin()
{ {
boot(); // required boot(); // required
bootUtils(); bootUtils();
bootLogo(); bootLogo();
// Audio // Audio
@ -37,13 +36,9 @@ void Arduboy::begin()
audio.begin(); audio.begin();
} }
// this is pusposely duplicated (without logo) so that void Arduboy::beginMinimal()
// whichever is actually used is linked and the one
// that is not is gone without wasting any space in flash
void Arduboy::beginNoLogo()
{ {
boot(); // required boot(); // required
bootUtils();
// Audio // Audio
tunes.initChannel(PIN_SPEAKER_1); tunes.initChannel(PIN_SPEAKER_1);
@ -51,14 +46,21 @@ void Arduboy::beginNoLogo()
audio.begin(); 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() void Arduboy::bootUtils()
{ {
// flashlight
if(pressed(UP_BUTTON)) { if(pressed(UP_BUTTON)) {
// sendLCDCommand(OLED_ALL_PIXELS_ON); // smaller than allPixelsOn() flashlight();
blank();
setRGBled(255,255,255);
while(true) {}
} }
} }

View File

@ -43,14 +43,23 @@ public:
/// Initializes the hardware /// Initializes the hardware
void begin(); void begin();
/// Initializes the hardware (but with no boot logo) /// Initializes the hardware (no logo, no other bootime niceities)
void beginNoLogo(); void beginMinimal();
void start() __attribute__ ((deprecated("use begin() instead"))); void start() __attribute__ ((deprecated("use begin() instead")));
/// Scrolls in the Arduboy logo /// Scrolls in the Arduboy logo
void bootLogo(); 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)); void inline bootUtils() __attribute__((always_inline));
/// Clears display. /// Clears display.