util.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Eurotec, Netherlands
3  * All rights reserved.
4  *
5  * Author: Jad Haj Mustafa
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #include <vector>
36 
37 namespace fadecandy_driver
38 {
42 struct Color
43 {
44  Color(int r, int g, int b);
45 
46  int r_;
47  int g_;
48  int b_;
49 };
50 
61 std::vector<std::vector<unsigned char>> makeVideoUsbPackets(const std::vector<std::vector<Color>>& led_array_colors);
62 
68 std::vector<std::vector<unsigned char>> makeLookupTablePackets(const std::vector<int>& red_lookup_values,
69  const std::vector<int>& green_lookup_values,
70  const std::vector<int>& blue_lookup_values);
76 std::vector<int> makeDefaultLookupTable();
77 } // namespace fadecandy_driver
std::vector< std::vector< unsigned char > > makeLookupTablePackets(const std::vector< int > &red_lookup_values, const std::vector< int > &green_lookup_values, const std::vector< int > &blue_lookup_values)
makeLookupTablePackets Create USB packets for a simple color lookup table. The entire red lookup tabl...
Definition: util.cpp:152
Color(int r, int g, int b)
Definition: util.cpp:55
The color struct contains the r, g and b colors.
Definition: util.h:42
std::vector< int > makeDefaultLookupTable()
makeLookupTablePackets Return lookup tables as 3 lists of lookup values - one for the red channel...
Definition: util.cpp:221
std::vector< std::vector< unsigned char > > makeVideoUsbPackets(const std::vector< std::vector< Color >> &led_array_colors)
makeVideoUsbPackets Construct the USB packets to set all LED strips to the given colors. To simplify things, we always send values for all 8 * 64 LEDs. If the physical strips are shorter, or there are less then 8 strips, the extra data doesn&#39;t do anything. If the user gives us values for less than the total number of strips, or less than the total number of LEDs in any given strip, all unspecified LEDs are left dark.
Definition: util.cpp:78


fadecandy_driver
Author(s):
autogenerated on Mon Feb 28 2022 22:18:46