mirror of https://github.com/MLXXXp/Arduboy2.git
audio on/off sets up pins appropriately for each mode
This commit is contained in:
parent
305423f600
commit
2361d0d20f
|
@ -5,6 +5,13 @@ bool ArduboyAudio::audio_enabled = false;
|
||||||
|
|
||||||
void ArduboyAudio::on()
|
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;
|
audio_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +23,13 @@ bool ArduboyAudio::enabled()
|
||||||
void ArduboyAudio::off()
|
void ArduboyAudio::off()
|
||||||
{
|
{
|
||||||
audio_enabled = false;
|
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()
|
void ArduboyAudio::saveOnOff()
|
||||||
|
|
|
@ -100,13 +100,12 @@
|
||||||
#define B_BUTTON _BV(0)
|
#define B_BUTTON _BV(0)
|
||||||
|
|
||||||
#define PIN_SPEAKER_1 A2
|
#define PIN_SPEAKER_1 A2
|
||||||
#define PIN_SPEAKER_2 A3
|
|
||||||
|
|
||||||
#define PIN_SPEAKER_1_PORT &PORTF
|
#define PIN_SPEAKER_1_PORT &PORTF
|
||||||
#define PIN_SPEAKER_2_PORT &PORTF
|
|
||||||
|
|
||||||
#define PIN_SPEAKER_1_BITMASK _BV(5)
|
#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
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue