Go to the documentation of this file.
7 #ifndef ARDUBOY2_BEEP_H
8 #define ARDUBOY2_BEEP_H
174 static void tone(uint16_t count);
196 static void tone(uint16_t count, uint8_t dur);
250 static constexpr uint16_t
freq(
const float hz)
252 return (uint16_t) (((F_CPU / 8 / 2) + (hz / 2)) / hz) - 1;
313 static void tone(uint16_t count);
325 static void tone(uint16_t count, uint8_t dur);
355 static constexpr uint16_t
freq(
const float hz)
357 return (uint16_t) (((F_CPU / 128 / 2) + (hz / 2)) / hz) - 1;
Play simple square wave tones using speaker pin 1.
static void noTone()
Stop a tone that is playing on speaker pin 2.
static void tone(uint16_t count)
Play a tone on speaker pin 2 continually, until replaced by a new tone or stopped.
static void begin()
Set up the hardware.
static uint8_t duration
The counter used by the timer() function to time the duration of a tone played on speaker pin 2.
static constexpr uint16_t freq(const float hz)
Convert a frequency to the required count.
Play simple square wave tones using speaker pin 2.
static void timer()
Handle the duration that a tone on speaker pin 2 plays for.
static void noTone()
Stop a tone that is playing.
static uint8_t duration
The counter used by the timer() function to time the duration of a tone.
static void tone(uint16_t count)
Play a tone continually, until replaced by a new tone or stopped.
static constexpr uint16_t freq(const float hz)
Convert a frequency to the required count for speaker pin 2.
static void begin()
Set up the hardware for playing tones using speaker pin 2.
static void timer()
Handle the duration that a tone plays for.