Files
ETcontroller_PRO/lib/GPIO/LED_Driver.h
2025-07-24 22:46:31 +02:00

62 lines
1.5 KiB
C++

#pragma once
#include <Arduino.h>
#define DEBUGLOG_DEFAULT_LOG_LEVEL_INFO
#include <DebugLog.h>
namespace drivers
{
class Led
{
const uint8_t c_ledPin = 38;
public:
typedef struct
{
uint8_t r;
uint8_t g;
uint8_t b;
} color_t;
const color_t COLOR_RED = {255, 0, 0};
const color_t COLOR_ORANGE = {255, 127, 0};
const color_t COLOR_YELLOW = {255, 255, 0};
const color_t COLOR_CHARTREUSE = {127, 255, 0};
const color_t COLOR_GREEN = {0, 255, 0};
const color_t COLOR_CYAN = {0, 255, 255};
const color_t COLOR_SKYBLUE = {0, 127, 255};
const color_t COLOR_BLUE = {0, 0, 255};
const color_t COLOR_VIOLET = {127, 0, 255};
const color_t COLOR_MAGENTA = {255, 0, 255};
private:
typedef struct
{
color_t color1;
color_t color2;
uint8_t pin;
uint16_t tOn;
uint16_t tOff;
TaskHandle_t blinkTask;
} led_params_t;
public:
Led();
~Led();
void setColor(const color_t color);
void blinkColor(const uint16_t tOn, const uint16_t tOff, const color_t color);
void blinkAlternate(const uint16_t tOn, const uint16_t tOff, const color_t color1, const color_t color2);
void blinkStop();
private:
static void blinkTask(void *params);
private:
led_params_t m_lp;
};
}