Flying Silicon Sensor
|
Functions | |
void | setBuzzer (int pin) |
static void | sound (int freq, int ms) |
static void | silence (void) |
void | beep (int freq, int ms) |
void | playMelody (const int melody[]) |
void | playCharging (void) |
void | playBattery (float batPct) |
void | playConnect (void) |
void | playDisconnect (void) |
void | playSwitchOff (void) |
Variables | |
static int | buzzerPin = 0 |
Buzzer pin to be used. | |
static const int | WholeNote = (60000 * 4) / 90 |
Duration of a whole note. | |
void Sounds::beep | ( | int | freq, |
int | ms | ||
) |
Let the buzzer and be sure to switch it properly off afterwards.
freq | Tone frequency Hz |
ms | Tone duration ms |
Definition at line 88 of file sounds.cpp.
References buzzerPin, silence(), and sound().
Referenced by playBattery(), playCharging(), playConnect(), playDisconnect(), playMelody(), and playSwitchOff().
void Sounds::playBattery | ( | float | batPct | ) |
void Sounds::playCharging | ( | void | ) |
void Sounds::playConnect | ( | void | ) |
Sound when BLE central is connected
Definition at line 197 of file sounds.cpp.
References beep(), and NOTE_G3.
Referenced by appLoop().
void Sounds::playDisconnect | ( | void | ) |
Sound when BLE central is disconnected
Definition at line 207 of file sounds.cpp.
References beep(), and NOTE_A2.
Referenced by appLoop().
void Sounds::playMelody | ( | const int | melody[] | ) |
Play a melody on the buzzer
The argument must contain a sequence of int pairs (freq, ms), terminated with MELODY_END
melody | Melody definition array |
Definition at line 105 of file sounds.cpp.
References beep(), BUZZER_MIN_HZ, and WholeNote.
Referenced by enable().
void Sounds::playSwitchOff | ( | void | ) |
void Sounds::setBuzzer | ( | int | pin | ) |
Enable/disable all sounds on specified buzzer
pin | The pin where the buzzer is connected, or 0 to disable sound |
Definition at line 44 of file sounds.cpp.
References buzzerPin.
Referenced by managePower().
|
static |
|
static |
Activate buzzer tone and return immediately Caution: Can leave the buzzer transistor open and drain the battery very fast.
freq | Tone frequency Hz |
ms | Tone duration ms |
Definition at line 55 of file sounds.cpp.
References BUZZER_MAX_HZ, BUZZER_MIN_HZ, BUZZER_MIN_MS, and buzzerPin.
Referenced by beep().
|
static |
Buzzer pin to be used.
Definition at line 34 of file sounds.cpp.
Referenced by beep(), setBuzzer(), silence(), and sound().
|
static |