summaryrefslogtreecommitdiff
path: root/libraries/ws2812.h
diff options
context:
space:
mode:
authorxengineering <mail2xengineering@protonmail.com>2020-10-31 20:49:22 +0100
committerxengineering <mail2xengineering@protonmail.com>2020-10-31 20:49:22 +0100
commit0314c77fd9fd9372bdef8c190cef7e78dc2ae5b2 (patch)
tree86f8a9ab0287dcdd9c923a2b49e8b6a07d167fc9 /libraries/ws2812.h
parent45def2a4827b206fc3e2351a29719d16b980338b (diff)
downloadstm32f103c8-examples-0314c77fd9fd9372bdef8c190cef7e78dc2ae5b2.tar
stm32f103c8-examples-0314c77fd9fd9372bdef8c190cef7e78dc2ae5b2.tar.zst
stm32f103c8-examples-0314c77fd9fd9372bdef8c190cef7e78dc2ae5b2.zip
ws2812: No usage of Heap anymore
Diffstat (limited to 'libraries/ws2812.h')
-rw-r--r--libraries/ws2812.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/libraries/ws2812.h b/libraries/ws2812.h
index e4f0754..c6c85d9 100644
--- a/libraries/ws2812.h
+++ b/libraries/ws2812.h
@@ -7,32 +7,31 @@
#include <stdlib.h>
#include <libopencm3/stm32/gpio.h>
+#define WS2812_NUMBER_OF_COLORS 3
-typedef struct ws2812_init_typedef{
+
+typedef struct WS2812_ARRAY{
uint32_t gpio_port;
uint16_t gpio_pin;
+ uint8_t *array_buffer;
uint32_t array_length;
- uint32_t matrix_width;
- uint8_t (*led_array)[3];
-
-}ws2812_init_typedef;
+}WS2812_ARRAY;
-void ws2812_init(ws2812_init_typedef *control_struct, uint32_t port, uint16_t pin, uint32_t array_length, uint32_t matrix_width);
-void ws2812_send_reset(ws2812_init_typedef *control_struct);
-void ws2812_send_zero(ws2812_init_typedef *control_struct);
-void ws2812_send_one(ws2812_init_typedef *control_struct);
+void ws2812_init(WS2812_ARRAY *control_struct, uint32_t port, uint16_t pin, uint8_t *buffer_ptr, uint32_t array_length);
-void ws2812_send_byte(ws2812_init_typedef *control_struct, uint8_t data);
-void ws2812_send_led(ws2812_init_typedef *control_struct, uint8_t red, uint8_t green, uint8_t blue);
-void ws2812_write_leds(ws2812_init_typedef *control_struct);
+void ws2812_send_reset(WS2812_ARRAY *control_struct);
+void ws2812_send_zero(WS2812_ARRAY *control_struct);
+void ws2812_send_one(WS2812_ARRAY *control_struct);
-void ws2812_set_array_led(ws2812_init_typedef *control_struct, uint32_t index, uint8_t red, uint8_t green, uint8_t blue);
-void ws2812_set_matrix_led(ws2812_init_typedef *control_struct, uint32_t x, uint32_t y, uint8_t red, uint8_t green, uint8_t blue);
+void ws2812_send_byte(WS2812_ARRAY *control_struct, uint8_t data);
+void ws2812_send_led(WS2812_ARRAY *control_struct, uint8_t red, uint8_t green, uint8_t blue);
-void ws2812_clear_buffer(ws2812_init_typedef *control_struct);
+void ws2812_write_leds(WS2812_ARRAY *control_struct);
+void ws2812_set_array_led(WS2812_ARRAY *control_struct, uint32_t index, uint8_t red, uint8_t green, uint8_t blue);
+void ws2812_clear_buffer(WS2812_ARRAY *control_struct);
#endif /* WS2812_H */