Tiny-WS2812  1.0.0
A tiny cross-platform WS2812 LED Strip driver
ws2812_cpp.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Patrick Pedersen
3 
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13 
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  *
17  */
18 
30 #ifdef __cplusplus
31 
32 #include <ws2812_cpp.h>
33 
34 ws2812_cpp::ws2812_cpp(ws2812_cfg *cfg, uint8_t *ret)
35 {
36  *ret = ws2812_config(&_ws2812, cfg);
37 }
38 
39 void ws2812_cpp::prep_tx()
40 {
41  ws2812_prep_tx(&_ws2812);
42 }
43 
44 void ws2812_cpp::tx(ws2812_rgb *leds, size_t n_leds)
45 {
46  ws2812_tx(&_ws2812, leds, n_leds);
47 }
48 
49 void ws2812_cpp::wait_rst()
50 {
51  ws2812_wait_rst(&_ws2812);
52 }
53 
54 void ws2812_cpp::close_tx()
55 {
56  ws2812_close_tx(&_ws2812);
57 }
58 
59 #endif // __cplusplus
ALL PLATFORMS: Data structure to configure a WS2812 device struct.
Definition: ws2812_avr.h:64
Data structure to hold RGB color values.
Definition: ws2812_common.h:67
void ws2812_close_tx(ws2812 *dev)
Closes a WS2812 transmission.
Definition: ws2812_avr.c:275
void ws2812_wait_rst(ws2812 *dev)
Waits for the WS2812 device to reset.
Definition: ws2812_avr.c:168
uint8_t ws2812_config(ws2812 *dev, ws2812_cfg *cfg)
Configures a WS2812 device struct.
Definition: ws2812_avr.c:126
void ws2812_prep_tx(ws2812 *dev)
Prepares the host device for data transmission.
Definition: ws2812_avr.c:159
void ws2812_tx(ws2812 *dev, ws2812_rgb *leds, size_t n_leds)
Transmits RGB values to the provided WS2812 device.
Definition: ws2812_avr.c:264
C++ Wrapper for the Tiny-WS2812 interface.