PASII/CandeII_1.4/Hardware/ws2812.h

41 lines
1.3 KiB
C
Raw Normal View History

/*****************************************************************
;Project: Light
;MCU:
;Date:
;File:
;Function:
******************************************************************/
#ifndef __WS2812_H
#define __WS2812_H
/*---------------------------------------------------------------*/
#include "ARMCM0.h"
/*---------------------------------------------------------------*/
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
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);
/*---------------------------------------------------------------*/
//<2F><EFBFBD><EAB6A8>
#define LED_NUM 10
#define GRB 24 //24bit
#define WS_DIN_PIN GPIO_15 //<2F><><EFBFBD><EFBFBD>SW<53><57><EFBFBD><EFBFBD><EFBFBD>ݽӿ<DDBD>
#define WS_EN_PIN GPIO_26 //<2F><><EFBFBD><EFBFBD>SW<53><57>ʹ<EFBFBD>ܽӿ<DCBD>
#define WS_HIGH(n) (*(uint32_t *)0x50001014UL |= n)
#define WS_LOW(n) (*(uint32_t *)0x50001014UL &= ~n)
#define WS_DIN_HIGH WS_HIGH(BIT15) //<2F><><EFBFBD><EFBFBD>SW<53><57><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>Ϊ1
#define WS_DIN_LOW WS_LOW(BIT15) //<2F><><EFBFBD><EFBFBD>SW<53><57><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>Ϊ0
#endif
/*---------------------------------------------------------------*/