1. changed default number of pwm LEDs to 256

2. Adds support for level shifters that invert the data
Config option - "invert" (integer)
if omitted, do not invert
if == 0, do not invert
if !=0, invert


Former-commit-id: fd5b2863a85b11ac3a8444d1e02822f852feb556
This commit is contained in:
penfold42
2016-03-22 23:50:14 +11:00
parent 9cbc005ee0
commit 6143075365
3 changed files with 10 additions and 6 deletions

View File

@@ -3,7 +3,7 @@
#include "LedDeviceWS281x.h"
// Constructor
LedDeviceWS281x::LedDeviceWS281x(const int gpio, const int leds, const uint32_t freq, const int dmanum, const int pwmchannel)
LedDeviceWS281x::LedDeviceWS281x(const int gpio, const int leds, const uint32_t freq, const int dmanum, const int pwmchannel, const int invert)
{
initialized = false;
led_string.freq = freq;
@@ -14,13 +14,13 @@ LedDeviceWS281x::LedDeviceWS281x(const int gpio, const int leds, const uint32_t
}
chan = pwmchannel;
led_string.channel[chan].gpionum = gpio;
led_string.channel[chan].invert = 0;
led_string.channel[chan].invert = invert;
led_string.channel[chan].count = leds;
led_string.channel[chan].brightness = 255;
led_string.channel[chan].strip_type = WS2811_STRIP_RGB;
led_string.channel[!chan].gpionum = 0;
led_string.channel[!chan].invert = 0;
led_string.channel[!chan].invert = invert;
led_string.channel[!chan].count = 0;
led_string.channel[!chan].brightness = 0;
led_string.channel[!chan].strip_type = WS2811_STRIP_RGB;