summaryrefslogtreecommitdiff
path: root/lib/buzzer/buzzer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/buzzer/buzzer.cpp')
-rw-r--r--lib/buzzer/buzzer.cpp31
1 files changed, 0 insertions, 31 deletions
diff --git a/lib/buzzer/buzzer.cpp b/lib/buzzer/buzzer.cpp
deleted file mode 100644
index 089f814..0000000
--- a/lib/buzzer/buzzer.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "buzzer.h"
-#include "settings.h"
-#include <Arduino.h>
-
-#define BUZZER_CHANNEL 3
-#define BUZZER_RESOLUTION 8
-#define BUZZER_FREQ 2000
-
-BUZZER::BUZZER() {}
-
-void BUZZER::init() {
- ledcSetup(BUZZER_CHANNEL, BUZZER_FREQ, BUZZER_RESOLUTION);
- ledcAttachPin(BUZZER_PIN, BUZZER_CHANNEL);
-}
-
-void BUZZER::playTone(uint16_t frequency, uint32_t duration) {
- ledcWriteTone(BUZZER_CHANNEL, frequency);
- if (duration > 0) {
- delay(duration);
- stop();
- }
-}
-
-void BUZZER::playMelody(const uint16_t melody[][2], size_t length) {
- for (size_t i = 0; i < length; i++) {
- playTone(melody[i][0], melody[i][1]);
- delay(50);
- }
-}
-
-void BUZZER::stop() { ledcWriteTone(BUZZER_CHANNEL, 0); }