41 lines
1.3 KiB
C
41 lines
1.3 KiB
C
/*****************************************************************
|
|
;Project: Light
|
|
;MCU:
|
|
;Date:
|
|
;File:
|
|
;Function:
|
|
******************************************************************/
|
|
#ifndef __WS2812_H
|
|
#define __WS2812_H
|
|
/*---------------------------------------------------------------*/
|
|
#include "ARMCM0.h"
|
|
/*---------------------------------------------------------------*/
|
|
//函数声明
|
|
void WS_Init(void);
|
|
void WS_Power(FunctionalState NewState);
|
|
void LedBuff_WriteNum(unsigned char numLed,unsigned int color);
|
|
void WS_WriteNum(unsigned char numLed, unsigned int color);
|
|
void LedBuff_WriteOrder(unsigned char ledOrder, unsigned int color);
|
|
void WS_WriteOrder(unsigned char ledOrder, unsigned int color);
|
|
void LedBuff_CleanAll(void);
|
|
void WS_CloseAll(void);
|
|
void WS_LightAll(void);
|
|
void WS_Show(void);
|
|
void WS_Show_Disable_irq(void);
|
|
/*---------------------------------------------------------------*/
|
|
//宏定义
|
|
#define LED_NUM 10
|
|
#define GRB 24 //24bit
|
|
|
|
#define WS_DIN_PIN GPIO_15 //定义SW的数据接口
|
|
#define WS_EN_PIN GPIO_26 //定义SW的使能接口
|
|
|
|
#define WS_HIGH(n) (*(uint32_t *)0x50001014UL |= n)
|
|
#define WS_LOW(n) (*(uint32_t *)0x50001014UL &= ~n)
|
|
|
|
#define WS_DIN_HIGH WS_HIGH(BIT15) //设置SW的数据口为1
|
|
#define WS_DIN_LOW WS_LOW(BIT15) //设置SW的数据口为0
|
|
|
|
#endif
|
|
/*---------------------------------------------------------------*/
|