48 lines
1.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef __RGB_H__
#define __RGB_H__
#include "main.h"
//0码和1码的定义设置的时CCR寄存器的值
//由于使用的思PWM输出模式1计数值<CCR时输出有效电平-高电平CubeMX配置默认有效电平为高电平
#define CODE_1 (840) //1码定时器计数次数控制占空比为84/125 = 66%
#define CODE_0 (700) //0码定时器计数次数控制占空比为42/125 = 33%
extern uint32_t period, pulse, dir;
//单个LED的颜色控制结构体
typedef struct
{
uint8_t R;
uint8_t G;
uint8_t B;
}RGB_Color_TypeDef;
#define Pixel_NUM 64 //LED数量宏定义我们灯板上有64个
static void Reset_Load(void); //该函数用于将数组最后24个数据变为0代表RESET_code
//发送最终数组
static void RGB_SendArray(void);
static void RGB_Flush(void); //刷新RGB显示
void RGB_SetOne_Color(uint8_t LedId,RGB_Color_TypeDef Color);//给一个LED装载24个颜色数据码0码和1码
//void RGB_RED(uint16_t Pixel_Len); //显示红灯
//控制多个LED显示相同的颜色
void RGB_SetMore_Color(uint8_t head, uint8_t heal,RGB_Color_TypeDef color);
void RGB_Show_64(void); //RGB写入函数
int RGB_Init(void);
#endif