summaryrefslogtreecommitdiff
path: root/drivers/avr/ws2812.c
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2019-10-29 01:00:03 +0000
committerDrashna Jael're <drashna@live.com>2019-12-05 16:03:53 -0800
commitc1d468a5b7ac837ed6594a8a249064dd72630324 (patch)
treeb7e8d351db8b6cc24e78c5392bd8e12d06e86916 /drivers/avr/ws2812.c
parent2a3cc8e2732d8b7767231e56f0d4f968c5c3d20b (diff)
Reduce duplication for ARM/AVR ws2812 RGB Matrix driver (#7180)
* Reduce duplication for ARM/AVR ws2812 rgb_matrix driver * Reduce duplication for ARM/AVR ws2812 rgb_matrix driver - Fix setled_all use of r,g,b
Diffstat (limited to 'drivers/avr/ws2812.c')
-rw-r--r--drivers/avr/ws2812.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/drivers/avr/ws2812.c b/drivers/avr/ws2812.c
index 0a02c6f7fd..5c733c4ab0 100644
--- a/drivers/avr/ws2812.c
+++ b/drivers/avr/ws2812.c
@@ -25,13 +25,17 @@
#include <avr/interrupt.h>
#include <avr/io.h>
#include <util/delay.h>
-#include "debug.h"
-#if !defined(LED_ARRAY) && defined(RGB_MATRIX_ENABLE)
-// LED color buffer
-LED_TYPE led[DRIVER_LED_TOTAL];
-# define LED_ARRAY led
-#endif
+/*
+ * Forward declare internal functions
+ *
+ * The functions take a byte-array and send to the data output as WS2812 bitstream.
+ * The length is the number of bytes to send - three per LED.
+ */
+
+void ws2812_sendarray(uint8_t *array, uint16_t length);
+void ws2812_sendarray_mask(uint8_t *array, uint16_t length, uint8_t pinmask);
+
#ifdef RGBW_BB_TWI
@@ -135,23 +139,6 @@ unsigned char I2C_Write(unsigned char c) {
#endif
-#ifdef RGB_MATRIX_ENABLE
-// Set an led in the buffer to a color
-void inline ws2812_setled(int i, uint8_t r, uint8_t g, uint8_t b) {
- led[i].r = r;
- led[i].g = g;
- led[i].b = b;
-}
-
-void ws2812_setled_all(uint8_t r, uint8_t g, uint8_t b) {
- for (int i = 0; i < sizeof(led) / sizeof(led[0]); i++) {
- led[i].r = r;
- led[i].g = g;
- led[i].b = b;
- }
-}
-#endif
-
// Setleds for standard RGB
void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) {
// ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin));