From 61e1bc97317c73483e6f744f3195c10241c1b35a Mon Sep 17 00:00:00 2001 From: JeongSeok Hong Date: Wed, 4 Jul 2018 10:28:55 +0900 Subject: [PATCH 1/3] Replaced rpi_ws281x module to use upsteam library --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 64ec998..db9871a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 From 3ad0b4ba51af7f0022726fd9a918a01bffc130ac Mon Sep 17 00:00:00 2001 From: HONGJS Date: Wed, 4 Jul 2018 11:46:29 +0900 Subject: [PATCH 2/3] Replaced rpi_ws281x module to use upsteam library --- src/rpi_ws281x | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpi_ws281x b/src/rpi_ws281x index 0524898..e4a05d6 160000 --- a/src/rpi_ws281x +++ b/src/rpi_ws281x @@ -1 +1 @@ -Subproject commit 05248980e760c43fe87ad905ae5f6edf8b824560 +Subproject commit e4a05d6538c02bb9714f2efc6630f2bfdcf35bf6 From 450898085399bf2e59726b420de30111cd8adad0 Mon Sep 17 00:00:00 2001 From: HONGJS Date: Wed, 4 Jul 2018 11:59:04 +0900 Subject: [PATCH 3/3] Replaced rpi_ws281x module to use upsteam library --- binding.gyp | 3 ++- src/rpi-ws281x.cc | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/binding.gyp b/binding.gyp index fd3346e..d12ccf9 100644 --- a/binding.gyp +++ b/binding.gyp @@ -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'] }, diff --git a/src/rpi-ws281x.cc b/src/rpi-ws281x.cc index a536c7f..0b511ac 100755 --- a/src/rpi-ws281x.cc +++ b/src/rpi-ws281x.cc @@ -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 @@ -66,6 +67,7 @@ void init(const Nan::FunctionCallbackInfo& info) { channel0data.invert = 0; channel0data.count = 0; channel0data.brightness = 255; + channel0data.strip_type = DEFAULT_STRIP_TYPE; channel1data.gpionum = 0; channel1data.invert = 0; @@ -95,7 +97,8 @@ void init(const Nan::FunctionCallbackInfo& info) { symDmaNum = Nan::New("dmaNum").ToLocalChecked(), symGpioPin = Nan::New("gpioPin").ToLocalChecked(), symInvert = Nan::New("invert").ToLocalChecked(), - symBrightness = Nan::New("brightness").ToLocalChecked(); + symBrightness = Nan::New("brightness").ToLocalChecked(), + symStripType = Nan::New("stripType").ToLocalChecked(); if(config->HasOwnProperty(symFreq)) { ledstring.freq = config->Get(symFreq)->Uint32Value(); @@ -116,6 +119,10 @@ void init(const Nan::FunctionCallbackInfo& 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