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
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();
}
}

View File

@ -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.