Skip to content

Commit 7333c75

Browse files
authored
Merge pull request #92 from Legion2/dev
Version 0.9.1
2 parents 9b5cdf0 + 4124bba commit 7333c75

File tree

6 files changed

+82
-22
lines changed

6 files changed

+82
-22
lines changed

.github/workflows/push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
sketch: [LightingNodePRO, SingleStripLightingNodePRO, CommanderPRO, DeviceIDTool, RepeatAndScale, TransformLLFansFormatToStrip, LS100, LightingNodeCORE]
9+
sketch: [LightingNodePRO, SingleStripLightingNodePRO, CommanderPRO, DeviceIDTool, RepeatAndScale, TransformLLFansFormatToStrip, LS100, LightingNodeCORE, NonAddressable]
1010
board: ["arduino:avr:leonardo", "arduino:avr:micro", "SparkFun:avr:promicro:cpu=16MHzatmega32U4"]
1111
steps:
1212
- uses: actions/checkout@master

examples/LS100/LS100.ino

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222

2323
#define BUTTON_PIN 4
2424

25+
// Hint: The ATmega32U4 does not have enough memory for 135 leds on both channels
2526
CRGB ledsChannel1[135];
26-
CRGB ledsChannel2[135];
27+
CRGB ledsChannel2[54];
2728

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

3334
void setup() {
3435
FastLED.addLeds<NEOPIXEL, DATA_PIN_CHANNEL_1>(ledsChannel1, 135);
35-
FastLED.addLeds<NEOPIXEL, DATA_PIN_CHANNEL_2>(ledsChannel2, 135);
36+
FastLED.addLeds<NEOPIXEL, DATA_PIN_CHANNEL_2>(ledsChannel2, 54);
3637
ledController.addLEDs(0, ledsChannel1, 135);
37-
ledController.addLEDs(1, ledsChannel2, 135);
38-
pinMode(BUTTON_PIN, INPUT_PULLUP);
38+
ledController.addLEDs(1, ledsChannel2, 54);
39+
pinMode(BUTTON_PIN, INPUT_PULLUP);
3940
}
4041

4142
void loop() {
4243
static bool lightingEnabled = true;
4344
cHID.update();
4445

45-
if (buttonClicked()) {
46-
lightingEnabled = !lightingEnabled;
47-
fill_solid(ledsChannel1, 135, CRGB::Black);
48-
fill_solid(ledsChannel2, 135, CRGB::Black);
49-
FastLED.show();
50-
}
46+
if (buttonClicked()) {
47+
lightingEnabled = !lightingEnabled;
48+
fill_solid(ledsChannel1, 135, CRGB::Black);
49+
fill_solid(ledsChannel2, 54, CRGB::Black);
50+
FastLED.show();
51+
}
5152

5253
if (lightingEnabled && ledController.updateLEDs()) {
53-
FastLED.show();
54+
FastLED.show();
5455
}
5556
}
5657

@@ -60,12 +61,12 @@ void loop() {
6061
* @return true if the button was pressed and then released.
6162
*/
6263
bool buttonClicked() {
63-
static bool previousState = 1;
64-
bool state = digitalRead(BUTTON_PIN);
65-
if (previousState == 0 && state == 1) {
66-
previousState = state;
67-
return true;
68-
}
69-
previousState = state;
70-
return false;
64+
static bool previousState = 1;
65+
bool state = digitalRead(BUTTON_PIN);
66+
if (previousState == 0 && state == 1) {
67+
previousState = state;
68+
return true;
69+
}
70+
previousState = state;
71+
return false;
7172
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
Copyright 2019 Leon Kiefer
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
#include <CorsairLightingProtocol.h>
17+
#include <FastLED.h>
18+
19+
// The Arduino pin where the physical LEDs are connected.
20+
// Must be PWM pins
21+
#define RED_PIN 3
22+
#define GREEN_PIN 5
23+
#define BLUE_PIN 6
24+
25+
CorsairLightingFirmware firmware = corsairLightingNodePROFirmware();
26+
FastLEDController ledController(true);
27+
CorsairLightingProtocolController cLP(&ledController, &firmware);
28+
CorsairLightingProtocolHID cHID(&cLP);
29+
30+
CRGB ledsChannel1[10];
31+
32+
void setup() {
33+
pinMode(RED_PIN, OUTPUT);
34+
pinMode(GREEN_PIN, OUTPUT);
35+
pinMode(BLUE_PIN, OUTPUT);
36+
ledController.addLEDs(0, ledsChannel1, 10);
37+
ledController.onUpdateHook(0, []() {
38+
// use color of first LED of the first channel
39+
set4PinLEDs(ledsChannel1[0]);
40+
});
41+
}
42+
43+
void loop() {
44+
cHID.update();
45+
ledController.updateLEDs();
46+
}
47+
48+
void set4PinLEDs(const CRGB& color) {
49+
analogWrite(RED_PIN, color.r);
50+
analogWrite(GREEN_PIN, color.g);
51+
analogWrite(BLUE_PIN, color.b);
52+
}

examples/NonAddressable/board.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# CorsairLightingProtocol build property overrides
2+
3+
build.vid=0x1b1c
4+
build.pid=0x0c0b
5+
build.usb_product="Lighting Node PRO"
6+
build.usb_manufacturer="Corsair"

extra/doxygen.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "Corsair Lighting Protocol"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 0.9.0
41+
PROJECT_NUMBER = 0.9.1
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

library.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Corsair Lighting Protocol
2-
version=0.9.0
2+
version=0.9.1
33
author=Leon Kiefer
44
maintainer=Leon Kiefer
55
sentence=Allows iCUE to control RGB LEDs.
@@ -8,3 +8,4 @@ category=Device Control
88
url=https://github.com/Legion2/CorsairLightingProtocol
99
architectures=*
1010
includes=CorsairLightingProtocol.h
11+
depends=FastLED

0 commit comments

Comments
 (0)