2 * light weight WS2812 lib include
4 * Version 2.3 - Nev 29th 2015
5 * Author: Tim (cpldcpu@gmail.com)
7 * Please do not change this file! All configuration is handled in "ws2812_config.h"
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #ifndef LIGHT_WS2812_H_
24 #define LIGHT_WS2812_H_
27 #include <avr/interrupt.h>
28 //#include "ws2812_config.h"
29 //#include "i2cmaster.h"
31 #include "quantum/color.h"
36 * ledarray: An array of GRB data describing the LED colors
37 * number_of_leds: The number of LEDs to write
38 * pinmask (optional): Bitmask describing the output bin. e.g. _BV(PB0)
40 * The functions will perform the following actions:
41 * - Set the data-out pin as output
42 * - Send out the LED data
43 * - Wait 50�s to reset the LEDs
45 #ifdef RGB_MATRIX_ENABLE
46 void ws2812_setled (int index, uint8_t r, uint8_t g, uint8_t b);
47 void ws2812_setled_all (uint8_t r, uint8_t g, uint8_t b);
50 void ws2812_setleds (LED_TYPE *ledarray, uint16_t number_of_leds);
51 void ws2812_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask);
52 void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);
55 * Old interface / Internal functions
57 * The functions take a byte-array and send to the data output as WS2812 bitstream.
58 * The length is the number of bytes to send - three per LED.
61 void ws2812_sendarray (uint8_t *array,uint16_t length);
62 void ws2812_sendarray_mask(uint8_t *array,uint16_t length, uint8_t pinmask);
69 #define CONCAT(a, b) a ## b
72 #define CONCAT_EXP(a, b) CONCAT(a, b)
75 #endif /* LIGHT_WS2812_H_ */