58 lines
827 B
C++
58 lines
827 B
C++
#include "buzzer.h"
|
|
#include <Arduino.h>
|
|
#include "config.h"
|
|
#include "state.h"
|
|
|
|
|
|
void Buzzer::playNote(uint16_t frequency, uint16_t duration)
|
|
{
|
|
tone(PinBuzzer, frequency);
|
|
delay(duration);
|
|
noTone(PinBuzzer);
|
|
}
|
|
|
|
|
|
void Buzzer::startup()
|
|
{
|
|
if (GetBuzzer() == BuzzerSetting::CompletedButtonStartup)
|
|
playNote(1000, 50);
|
|
}
|
|
|
|
|
|
void Buzzer::select()
|
|
{
|
|
if (GetBuzzer() <= BuzzerSetting::CompletedButton)
|
|
playNote(1000, 1);
|
|
}
|
|
|
|
|
|
void Buzzer::click()
|
|
{
|
|
if (GetBuzzer() <= BuzzerSetting::CompletedButton)
|
|
playNote(1000, 25);
|
|
}
|
|
|
|
|
|
void Buzzer::completed()
|
|
{
|
|
if (GetBuzzer() <= BuzzerSetting::Completed)
|
|
{
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
playNote(1000, 250);
|
|
delay(500);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void Buzzer::memoryCleared()
|
|
{
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
playNote(1000, 25);
|
|
delay(250);
|
|
}
|
|
}
|
|
|