2022-05-22 21:55:22 -06:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
#define POLYBUZZER_MAX_TONES 2
|
|
|
|
|
|
|
|
// PolyBuzzer provides a proritized monophonic buzzer.
|
|
|
|
//
|
|
|
|
// A given tone will only be played when all higher priority tones have stopped.
|
|
|
|
class PolyBuzzer {
|
|
|
|
public:
|
|
|
|
unsigned int tones[POLYBUZZER_MAX_TONES];
|
|
|
|
unsigned int playing;
|
|
|
|
uint8_t pin;
|
|
|
|
|
|
|
|
PolyBuzzer(uint8_t pin);
|
|
|
|
void update();
|
|
|
|
void Tone(int slot, unsigned int frequency);
|
2023-02-25 18:10:14 -07:00
|
|
|
void Note(int slot, uint8_t note);
|
2022-05-22 21:55:22 -06:00
|
|
|
void NoTone(int slot);
|
|
|
|
};
|