Added Buzzer and RGB led drivers
This commit is contained in:
38
lib/GPIO/BUZZER_Driver.h
Normal file
38
lib/GPIO/BUZZER_Driver.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#define DEBUGLOG_DEFAULT_LOG_LEVEL_INFO
|
||||
#include <DebugLog.h>
|
||||
|
||||
namespace drivers
|
||||
{
|
||||
|
||||
class Buzzer
|
||||
{
|
||||
const uint8_t buzzerPin = 46; // hardware assigned
|
||||
typedef struct
|
||||
{
|
||||
note_t note;
|
||||
uint8_t pin;
|
||||
uint16_t tOn;
|
||||
uint16_t tOff;
|
||||
TaskHandle_t beeperTask;
|
||||
} beep_params_t;
|
||||
|
||||
public:
|
||||
Buzzer();
|
||||
~Buzzer();
|
||||
|
||||
void beep(const uint16_t tBeep, const note_t note);
|
||||
void beepRepeat(const uint16_t tOn, const uint16_t tOff, const note_t note);
|
||||
void beepStop();
|
||||
|
||||
private:
|
||||
static void beepTask(void *params);
|
||||
|
||||
private:
|
||||
beep_params_t m_bp;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user