40 lines
636 B
C++
40 lines
636 B
C++
/// © MiroZ 2024
|
|
|
|
#ifndef __LED_H__
|
|
#define __LED_H__
|
|
|
|
#include <stdint.h>
|
|
#include <Adafruit_NeoPixel.h>
|
|
#include "TaskFactory.h"
|
|
|
|
|
|
class Led
|
|
{
|
|
public:
|
|
enum PROGRAM{
|
|
STEADY,
|
|
PULSATING
|
|
};
|
|
|
|
protected:
|
|
Adafruit_NeoPixel *m_strip;
|
|
TaskHandle_t m_task = nullptr;
|
|
PROGRAM m_program;
|
|
uint8_t m_r, m_g, m_b;
|
|
uint8_t m_brightness = 100;
|
|
|
|
protected:
|
|
void run();
|
|
void steady(uint8_t r, uint8_t g, uint8_t b, uint8_t delay);
|
|
|
|
public:
|
|
Led(uint32_t led_pin);
|
|
virtual ~Led();
|
|
|
|
public:
|
|
void setBrightness(uint8_t brightness);
|
|
void setColor(uint8_t r, uint8_t g, uint8_t b);
|
|
void setPulse(uint8_t r, uint8_t g, uint8_t b);
|
|
};
|
|
|
|
#endif |