Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed submodule to use @jgarff's rpi_ws281x #86

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "src/rpi_ws281x"]
path = src/rpi_ws281x
url = https://github.com/beyondscreen/rpi_ws281x.git
url = https://github.com/jgarff/rpi_ws281x.git
3 changes: 2 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
'./src/rpi_ws281x/pwm.c',
'./src/rpi_ws281x/dma.c',
'./src/rpi_ws281x/mailbox.c',
'./src/rpi_ws281x/board_info.c'
'./src/rpi_ws281x/pcm.c',
'./src/rpi_ws281x/rpihw.c'
],
'cflags': ['-O2', '-Wall']
},
Expand Down
11 changes: 9 additions & 2 deletions src/rpi-ws281x.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ using namespace v8;

#define DEFAULT_TARGET_FREQ 800000
#define DEFAULT_GPIO_PIN 18
#define DEFAULT_DMANUM 5
#define DEFAULT_DMANUM 10
#define DEFAULT_STRIP_TYPE WS2811_STRIP_GRB

ws2811_t ledstring;
ws2811_channel_t
Expand Down Expand Up @@ -66,6 +67,7 @@ void init(const Nan::FunctionCallbackInfo<v8::Value>& info) {
channel0data.invert = 0;
channel0data.count = 0;
channel0data.brightness = 255;
channel0data.strip_type = DEFAULT_STRIP_TYPE;

channel1data.gpionum = 0;
channel1data.invert = 0;
Expand Down Expand Up @@ -95,7 +97,8 @@ void init(const Nan::FunctionCallbackInfo<v8::Value>& info) {
symDmaNum = Nan::New<String>("dmaNum").ToLocalChecked(),
symGpioPin = Nan::New<String>("gpioPin").ToLocalChecked(),
symInvert = Nan::New<String>("invert").ToLocalChecked(),
symBrightness = Nan::New<String>("brightness").ToLocalChecked();
symBrightness = Nan::New<String>("brightness").ToLocalChecked(),
symStripType = Nan::New<String>("stripType").ToLocalChecked();

if(config->HasOwnProperty(symFreq)) {
ledstring.freq = config->Get(symFreq)->Uint32Value();
Expand All @@ -116,6 +119,10 @@ void init(const Nan::FunctionCallbackInfo<v8::Value>& info) {
if(config->HasOwnProperty(symBrightness)) {
ledstring.channel[0].brightness = config->Get(symBrightness)->Int32Value();
}

if(config->HasOwnProperty(symStripType)) {
ledstring.channel[0].strip_type = config->Get(symStripType)->Int32Value();
}
}

// FIXME: handle errors, throw JS-Exception
Expand Down