This repository was archived by the owner on May 6, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +144
-155
lines changed Expand file tree Collapse file tree 6 files changed +144
-155
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ message(STATUS "ENABLE_DISPMANX = " ${ENABLE_DISPMANX})
13
13
option (ENABLE_SPIDEV "Enable the SPIDEV device" ON )
14
14
message (STATUS "ENABLE_SPIDEV = " ${ENABLE_SPIDEV} )
15
15
16
+ option (ENABLE_WS2812BPWM "Enable the WS2812b-PWM device" ON )
17
+ message (STATUS "ENABLE_WS2812BPWM = " ${ENABLE_WS2812BPWM} )
18
+
16
19
option (ENABLE_V4L2 "Enable the V4L2 grabber" ON )
17
20
message (STATUS "ENABLE_V4L2 = " ${ENABLE_V4L2} )
18
21
@@ -22,9 +25,9 @@ message(STATUS "ENABLE_TINKERFORGE = " ${ENABLE_TINKERFORGE})
22
25
option (ENABLE_PROTOBUF "Enable PROTOBUF server" ON )
23
26
message (STATUS "ENABLE_PROTOBUF = " ${ENABLE_PROTOBUF} )
24
27
25
- if (ENABLE_V4L2 AND NOT ENABLE_PROTOBUF )
28
+ if (ENABLE_V4L2 AND NOT ENABLE_PROTOBUF )
26
29
message (FATAL_ERROR "V4L2 grabber requires PROTOBUF. Disable V4L2 or enable PROTOBUF" )
27
- endif (ENABLE_V4L2 AND NOT ENABLE_PROTOBUF )
30
+ endif (ENABLE_V4L2 AND NOT ENABLE_PROTOBUF )
28
31
29
32
# Createt the configuration file
30
33
# configure a header file to pass some of the CMake settings
Original file line number Diff line number Diff line change 9
9
// Define to enable the spi-device
10
10
#cmakedefine ENABLE_SPIDEV
11
11
12
+ // Define to enable the ws2812b-pwm-device
13
+ #cmakedefine ENABLE_WS2812BPWM
14
+
12
15
// Define to enable the spi-device
13
16
#cmakedefine ENABLE_TINKERFORGE
14
17
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ if(ENABLE_SPIDEV)
68
68
)
69
69
endif (ENABLE_SPIDEV )
70
70
71
+ if (ENABLE_WS2812BPWM )
71
72
SET (Leddevice_HEADERS
72
73
${Leddevice_HEADERS}
73
74
${CURRENT_SOURCE_DIR} /LedDeviceWS2812b.h
@@ -76,6 +77,7 @@ SET(Leddevice_SOURCES
76
77
${Leddevice_SOURCES}
77
78
${CURRENT_SOURCE_DIR} /LedDeviceWS2812b.cpp
78
79
)
80
+ endif (ENABLE_WS2812BPWM )
79
81
80
82
if (ENABLE_TINKERFORGE )
81
83
SET (Leddevice_HEADERS
Original file line number Diff line number Diff line change 31
31
#include " LedDevicePhilipsHue.h"
32
32
#include " LedDeviceTpm2.h"
33
33
34
- #include " LedDeviceWS2812b.h"
34
+ #ifdef ENABLE_WS2812BPWM
35
+ #include " LedDeviceWS2812b.h"
36
+ #endif
35
37
36
38
LedDevice * LedDeviceFactory::construct (const Json::Value & deviceConfig)
37
39
{
@@ -180,14 +182,17 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
180
182
const std::string output = deviceConfig[" output" ].asString ();
181
183
const unsigned rate = deviceConfig[" rate" ].asInt ();
182
184
183
- LedDeviceTpm2* deviceTpm2 = new LedDeviceTpm2 (output, rate);
185
+ LedDeviceTpm2 * deviceTpm2 = new LedDeviceTpm2 (output, rate);
184
186
deviceTpm2->open ();
185
187
device = deviceTpm2;
186
- }else if (type == " ws2812b" )
188
+ }
189
+ #ifdef ENABLE_WS2812BPWM
190
+ else if (type == " ws2812b" )
187
191
{
188
192
LedDeviceWS2812b * ledDeviceWS2812b = new LedDeviceWS2812b ();
189
193
device = ledDeviceWS2812b;
190
194
}
195
+ #endif
191
196
else
192
197
{
193
198
std::cout << " Unable to create device " << type << std::endl;
You can’t perform that action at this time.
0 commit comments