Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Erik Johnson
ws2812-stm32
Commits
b4ab5c80
Commit
b4ab5c80
authored
8 months ago
by
Erik Johnson
Browse files
Options
Download
Email Patches
Plain Diff
Replace ws2812_dma.h
parent
e3b1a3dd
master
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ws2812_dma.h
+12
-12
ws2812_dma.h
with
12 additions
and
12 deletions
+12
-12
ws2812_dma.h
+
12
-
12
View file @
b4ab5c80
...
...
@@ -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_colour
s
_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_colour
s
_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_ */
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help