Commit b4ab5c80 authored by Erik Johnson's avatar Erik Johnson
Browse files

Replace ws2812_dma.h

parent e3b1a3dd
No related merge requests found
Showing with 12 additions and 12 deletions
+12 -12
......@@ -10,17 +10,13 @@
#include "stm32f1xx_hal.h"
// #define WS2812_USE_RGBW
typedef enum {
WS2812_GREEN,
WS2812_RED,
WS2812_GREEN,
WS2812_BLUE,
#ifdef WS2812_USE_RGBW
WS2812_WHITE,
#endif
WS2812_NUM_COLOURS,
} ws2812_colours_t;
} ws2812_colour_t;
typedef enum {
WS2812_READY,
......@@ -28,27 +24,31 @@ typedef enum {
WS2812_TIMER_BUSY,
} ws2812_status_t;
typedef enum {
WS2812_RGB = WS2812_NUM_COLOURS - 1,
WS2812_RGBW = WS2812_NUM_COLOURS,
} ws2812_ledtype_t;
#define WS2812_BITS_PER_COLOUR 8
#define WS2812_DMA_LED_SIZE (WS2812_NUM_COLOURS * WS2812_BITS_PER_COLOUR)
#define WS2812_DMA_NUM_LEDS 2
#define WS2812_DMA_BUF_LEN (WS2812_DMA_NUM_LEDS * WS2812_DMA_LED_SIZE)
#define WS2812_RESET_PULSE_LEN 2
typedef struct ws2812_channel_struct {
DMA_HandleTypeDef * dma_handle;
uint8_t timer_channel;
uint32_t * strip_buffer;
ws2812_ledtype_t strip_type;
uint16_t strip_length;
uint16_t dma_size;
ws2812_status_t status;
uint16_t current_led;
uint16_t dma_buffer[WS2812_DMA_BUF_LEN];
uint16_t dma_buffer[WS2812_DMA_NUM_LEDS * WS2812_NUM_COLOURS * WS2812_BITS_PER_COLOUR];
struct ws2812_channel_struct * next;
} ws2812_channel;
ws2812_channel * WS2812_Create_Channel(DMA_HandleTypeDef * dma_handle, uint8_t timer_channel, uint16_t strip_length);
uint8_t WS2812_Set_Pixel(ws2812_channel * channel, uint16_t pixel, ws2812_colours_t colour, uint8_t value);
ws2812_channel * WS2812_Create_Channel(DMA_HandleTypeDef * dma_handle, uint8_t timer_channel, ws2812_ledtype_t strip_type, uint16_t strip_length);
uint8_t WS2812_Set_Pixel(ws2812_channel * channel, uint16_t pixel, ws2812_colour_t colour, uint8_t value);
void WS2812_Start(ws2812_channel * channel);
ws2812_status_t WS2812_Get_Status(ws2812_channel * channel);
#endif /* WS2812_DMA_H_ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment