#pragma once

#include <Arduino.h>

#define DEBUGLOG_DEFAULT_LOG_LEVEL_INFO
#include <DebugLog.h>

namespace drivers
{

    class Led
    {
        const uint8_t ledPin = 38;

    public:
        typedef struct
        {
            uint8_t r;
            uint8_t g;
            uint8_t b;
        } color_t;

    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;
    };

}
