//WS2812灯带控制器



#ifndef __WS2812_H__
#define __WS2812_H__

#include <stdint.h>
#include "main.h"
#define WS2812_NUM  5 //灯珠数量（分边）
#define WS2812_IO PA3   //引脚
#define BREATH_NUM 50   //呼吸灯变化次数

struct str_ws2812
{
    uint32_t light_color[2];
    uint32_t light_color_use[2];
    uint8_t light_mode[2];
    uint16_t light_speed[2];
    uint8_t breath_count[2];
    uint8_t breath_dir[2];
};

enum light_mode_type
{
    MODE_NORMAL,    //常亮
    MODE_BLINK,     //闪烁
    MODE_BREATH,    //呼吸
};


enum light_color_type
{
    COLOR_BLUE = 0x000088,      //蓝
    COLOR_GREEN = 0x008800,     //绿
    COLOR_RED = 0x880000,       //红
    COLOR_YELLOW = 0x888800,    //黄
};


void light_ctrl(void);
void light_refresh(uint32_t rgb_left, uint32_t rgb_right);
void light_set(uint8_t mode_select, uint16_t speed_ms, uint32_t rgb_color, uint8_t channel);


#endif
