# modules/ws2812/ws2812.c File Reference

`#include <mios32.h>`
`#include <math.h>`
`#include "ws2812.h"`

## Defines
#define | WS2812_SUPPORTED 0
#define | WS2812_TIM_OUT_PORT GPIOB
#define | WS2812_TIM_OUT_PIN GPIO_Pin_6
#define | WS2812_TIM TIM4
#define | WS2812_TIM_CCR WS2812_TIM->CCR1
#define | WS2812_TIM_DMA_TRG TIM_DMA_CC1
#define | WS2812_TIM_REMAP_FUNC { GPIO_PinAFConfig(GPIOB, GPIO_PinSource6, GPIO_AF_TIM4); }
#define | WS2812_TIM_CLK_FUNC { RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE); }
#define | WS2812_TIM_PERIOD ((MIOS32_SYS_CPU_FREQUENCY/2) / 800000)
#define | WS2812_TIM_CC_RESET 0
#define | WS2812_TIM_CC_IDLE WS2812_TIM_PERIOD
#define | WS2812_TIM_CC_LOW (u16)((WS2812_TIM_PERIOD - 1) * 0.28)
#define | WS2812_TIM_CC_HIGH (u16)((WS2812_TIM_PERIOD - 1) * 0.74)
#define | WS2812_DMA_PTR DMA1_Stream0
#define | WS2812_DMA_CHN DMA_Channel_2
#define | WS2812_BUFFER_SIZE ((WS2812_NUM_LEDS+2)*24)
## Functions
s32 | WS2812_Init (u32 mode)
s32 | WS2812_LED_SetRGB (u16 led, u8 colour, u8 value)
s32 | WS2812_LED_GetRGB (u16 led, u8 colour)
s32 | WS2812_LED_SetHSV (u16 led, float h, float s, float v)
s32 | WS2812_LED_GetHSV (u16 led, float *h, float *s, float *v)