vail-adapter/polybuzzer.h

21 lines
485 B
C
Raw Normal View History

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);
void Note(int slot, int note);
void NoTone(int slot);
};