38#include <avr/pgmspace.h>
42#define PLAY_AUTOMATIC 0
62#define NOTE_C(x) ( 0 + (x)*12)
63#define NOTE_C_SHARP(x) ( 1 + (x)*12)
64#define NOTE_D_FLAT(x) ( 1 + (x)*12)
65#define NOTE_D(x) ( 2 + (x)*12)
66#define NOTE_D_SHARP(x) ( 3 + (x)*12)
67#define NOTE_E_FLAT(x) ( 3 + (x)*12)
68#define NOTE_E(x) ( 4 + (x)*12)
69#define NOTE_F(x) ( 5 + (x)*12)
70#define NOTE_F_SHARP(x) ( 6 + (x)*12)
71#define NOTE_G_FLAT(x) ( 6 + (x)*12)
72#define NOTE_G(x) ( 7 + (x)*12)
73#define NOTE_G_SHARP(x) ( 8 + (x)*12)
74#define NOTE_A_FLAT(x) ( 8 + (x)*12)
75#define NOTE_A(x) ( 9 + (x)*12)
76#define NOTE_A_SHARP(x) (10 + (x)*12)
77#define NOTE_B_FLAT(x) (10 + (x)*12)
78#define NOTE_B(x) (11 + (x)*12)
81#define SILENT_NOTE 0xFF
86#define DIV_BY_10 (1 << 15)
145 static void playFrequency(
unsigned int freq,
unsigned int duration,
146 unsigned char volume);
171 static void playNote(
unsigned char note,
unsigned int duration,
172 unsigned char volume);
264 static void play(
const char *sequence);
310 static void playMode(
unsigned char mode);
Play beeps and music with the buzzer.
static void playFromProgramSpace(const char *sequence)
Plays the specified sequence of notes from program space.
static void play(const char *sequence)
Plays the specified sequence of notes.
static void stopPlaying()
Stops any note, frequency, or melody being played.
static unsigned char playCheck()
Starts the next note in a sequence, if necessary, in PLAY_CHECK mode.
static unsigned char isPlaying()
Checks whether a note, frequency, or sequence is being played.
static void playFrequency(unsigned int freq, unsigned int duration, unsigned char volume)
Plays the specified frequency for the specified duration.
static void playNote(unsigned char note, unsigned int duration, unsigned char volume)
Plays the specified note for the specified duration.
static void playMode(unsigned char mode)
Controls whether play() sequence is played automatically or must be driven with playCheck().