we already have a minimal begin, it's boot()

This commit is contained in:
Josh Goebel 2016-02-20 14:54:06 -05:00 committed by Scott Allen
parent c25668de0e
commit 6ff1c13b22
4 changed files with 26 additions and 18 deletions

View File

@ -26,27 +26,21 @@ void Arduboy::start() // deprecated
void Arduboy::begin()
{
boot();
boot(); // raw hardware
// utils
if(pressed(UP_BUTTON)) {
flashlight();
}
bootLogo();
// Audio
tunes.initChannel(PIN_SPEAKER_1);
tunes.initChannel(PIN_SPEAKER_2);
audio.begin();
}
void Arduboy::beginMinimal()
void Arduboy::beginNoLogo() // deprecated
{
boot();
// Audio
tunes.initChannel(PIN_SPEAKER_1);
tunes.initChannel(PIN_SPEAKER_2);
audio.begin();
}

View File

@ -41,16 +41,25 @@ public:
*/
boolean notPressed(uint8_t buttons);
/// Initializes the hardware
/// Initialize hardware, boot logo, boot utilities, etc.
void begin();
/// Initializes the hardware (no logo, no other bootime niceities)
/// Init hardware, no logo, no boot utilities.
/**
* If you want to build your own customized boot sequence compare
* begin() with beginMinimal() and just add back the things you wish
* to have in your own sequence, leaving out the things you do not
* desire.
**/
void beginMinimal();
* If you really want this functionality going foward we recommend
* just call `boot()` directly, then do any other custom init you
* desire before passing control into your main sketch.
*
* Look at the source for `begin()` and just rip out what you do not
* need and start there.
*
* The minimum functionality required is currently:
*
* boot() // raw hardware init (from core)
* audio.begin() // if you need audio
*/
void beginNoLogo() __attribute__ ((deprecated("use boot() + custom code instead")));
void start() __attribute__ ((deprecated("use begin() instead")));
/// Scrolls in the Arduboy logo

View File

@ -43,6 +43,11 @@ bool ArduboyAudio::audio_enabled = false;
void ArduboyAudio::on()
{
// JIT audio init
if (_tune_num_chans == 0) {
ArduboyTunes::initChannel(PIN_SPEAKER_1);
ArduboyTunes::initChannel(PIN_SPEAKER_2);
}
power_timer1_enable();
power_timer3_enable();
audio_enabled = true;

View File

@ -33,7 +33,7 @@ public:
// Playtune Functions
/// Assign a timer to an output pin.
void initChannel(byte pin);
void static initChannel(byte pin);
/// Start playing a polyphonic score.
void playScore(const byte *score);