diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index c83aaf6..5785e00 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -5,6 +5,13 @@ bool ArduboyAudio::audio_enabled = false; void ArduboyAudio::on() { + // fire up audio pins +#ifdef ARDUBOY_10 + pinMode(PIN_SPEAKER_1, OUTPUT); + pinMode(PIN_SPEAKER_2, OUTPUT); +#else + pinMode(PIN_SPEAKER_1, OUTPUT); +#endif audio_enabled = true; } @@ -16,6 +23,13 @@ bool ArduboyAudio::enabled() void ArduboyAudio::off() { audio_enabled = false; + // shut off audio pins + #ifdef ARDUBOY_10 + pinMode(PIN_SPEAKER_1, INPUT); + pinMode(PIN_SPEAKER_2, INPUT); + #else + pinMode(PIN_SPEAKER_1, INPUT); + #endif } void ArduboyAudio::saveOnOff() diff --git a/src/core/core.h b/src/core/core.h index 4af92da..dcbf6b1 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -100,13 +100,12 @@ #define B_BUTTON _BV(0) #define PIN_SPEAKER_1 A2 -#define PIN_SPEAKER_2 A3 - #define PIN_SPEAKER_1_PORT &PORTF -#define PIN_SPEAKER_2_PORT &PORTF - #define PIN_SPEAKER_1_BITMASK _BV(5) -#define PIN_SPEAKER_2_BITMASK _BV(4) +// SPEAKER_2 is purposely not defined for DEVKIT as it could potentially +// be dangerous and fry your hardware (because of the devkit wiring). +// +// Reference: https://github.com/Arduboy/Arduboy/issues/108 #endif