Skip to content

Commit

Permalink
Merge pull request #92 from Legion2/dev
Browse files Browse the repository at this point in the history
Version 0.9.1
  • Loading branch information
Legion2 authored Dec 31, 2019
2 parents 9b5cdf0 + 4124bba commit 7333c75
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
sketch: [LightingNodePRO, SingleStripLightingNodePRO, CommanderPRO, DeviceIDTool, RepeatAndScale, TransformLLFansFormatToStrip, LS100, LightingNodeCORE]
sketch: [LightingNodePRO, SingleStripLightingNodePRO, CommanderPRO, DeviceIDTool, RepeatAndScale, TransformLLFansFormatToStrip, LS100, LightingNodeCORE, NonAddressable]
board: ["arduino:avr:leonardo", "arduino:avr:micro", "SparkFun:avr:promicro:cpu=16MHzatmega32U4"]
steps:
- uses: actions/checkout@master
Expand Down
39 changes: 20 additions & 19 deletions examples/LS100/LS100.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@

#define BUTTON_PIN 4

// Hint: The ATmega32U4 does not have enough memory for 135 leds on both channels
CRGB ledsChannel1[135];
CRGB ledsChannel2[135];
CRGB ledsChannel2[54];

CorsairLightingFirmware firmware = corsairLS100Firmware();
FastLEDController ledController(true);
Expand All @@ -32,25 +33,25 @@ CorsairLightingProtocolHID cHID(&cLP);

void setup() {
FastLED.addLeds<NEOPIXEL, DATA_PIN_CHANNEL_1>(ledsChannel1, 135);
FastLED.addLeds<NEOPIXEL, DATA_PIN_CHANNEL_2>(ledsChannel2, 135);
FastLED.addLeds<NEOPIXEL, DATA_PIN_CHANNEL_2>(ledsChannel2, 54);
ledController.addLEDs(0, ledsChannel1, 135);
ledController.addLEDs(1, ledsChannel2, 135);
pinMode(BUTTON_PIN, INPUT_PULLUP);
ledController.addLEDs(1, ledsChannel2, 54);
pinMode(BUTTON_PIN, INPUT_PULLUP);
}

void loop() {
static bool lightingEnabled = true;
cHID.update();

if (buttonClicked()) {
lightingEnabled = !lightingEnabled;
fill_solid(ledsChannel1, 135, CRGB::Black);
fill_solid(ledsChannel2, 135, CRGB::Black);
FastLED.show();
}
if (buttonClicked()) {
lightingEnabled = !lightingEnabled;
fill_solid(ledsChannel1, 135, CRGB::Black);
fill_solid(ledsChannel2, 54, CRGB::Black);
FastLED.show();
}

if (lightingEnabled && ledController.updateLEDs()) {
FastLED.show();
FastLED.show();
}
}

Expand All @@ -60,12 +61,12 @@ void loop() {
* @return true if the button was pressed and then released.
*/
bool buttonClicked() {
static bool previousState = 1;
bool state = digitalRead(BUTTON_PIN);
if (previousState == 0 && state == 1) {
previousState = state;
return true;
}
previousState = state;
return false;
static bool previousState = 1;
bool state = digitalRead(BUTTON_PIN);
if (previousState == 0 && state == 1) {
previousState = state;
return true;
}
previousState = state;
return false;
}
52 changes: 52 additions & 0 deletions examples/NonAddressable/NonAddressable.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
Copyright 2019 Leon Kiefer
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <CorsairLightingProtocol.h>
#include <FastLED.h>

// The Arduino pin where the physical LEDs are connected.
// Must be PWM pins
#define RED_PIN 3
#define GREEN_PIN 5
#define BLUE_PIN 6

CorsairLightingFirmware firmware = corsairLightingNodePROFirmware();
FastLEDController ledController(true);
CorsairLightingProtocolController cLP(&ledController, &firmware);
CorsairLightingProtocolHID cHID(&cLP);

CRGB ledsChannel1[10];

void setup() {
pinMode(RED_PIN, OUTPUT);
pinMode(GREEN_PIN, OUTPUT);
pinMode(BLUE_PIN, OUTPUT);
ledController.addLEDs(0, ledsChannel1, 10);
ledController.onUpdateHook(0, []() {
// use color of first LED of the first channel
set4PinLEDs(ledsChannel1[0]);
});
}

void loop() {
cHID.update();
ledController.updateLEDs();
}

void set4PinLEDs(const CRGB& color) {
analogWrite(RED_PIN, color.r);
analogWrite(GREEN_PIN, color.g);
analogWrite(BLUE_PIN, color.b);
}
6 changes: 6 additions & 0 deletions examples/NonAddressable/board.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# CorsairLightingProtocol build property overrides

build.vid=0x1b1c
build.pid=0x0c0b
build.usb_product="Lighting Node PRO"
build.usb_manufacturer="Corsair"
2 changes: 1 addition & 1 deletion extra/doxygen.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Corsair Lighting Protocol"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 0.9.0
PROJECT_NUMBER = 0.9.1

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
3 changes: 2 additions & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Corsair Lighting Protocol
version=0.9.0
version=0.9.1
author=Leon Kiefer
maintainer=Leon Kiefer
sentence=Allows iCUE to control RGB LEDs.
Expand All @@ -8,3 +8,4 @@ category=Device Control
url=https://github.com/Legion2/CorsairLightingProtocol
architectures=*
includes=CorsairLightingProtocol.h
depends=FastLED

0 comments on commit 7333c75

Please sign in to comment.