Skip to content

Commit ed58d14

Browse files
authored
Merge pull request #100 from Legion2/ambient-backlight
added AmbientBacklight sketch for monitors
2 parents 8b1edfc + 974fb85 commit ed58d14

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
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, NonAddressable]
9+
sketch: [LightingNodePRO, SingleStripLightingNodePRO, CommanderPRO, DeviceIDTool, RepeatAndScale, TransformLLFansFormatToStrip, LS100, LightingNodeCORE, NonAddressable, AmbientBacklight]
1010
board: ["arduino:avr:leonardo", "arduino:avr:micro", "SparkFun:avr:promicro:cpu=16MHzatmega32U4"]
1111
steps:
1212
- uses: actions/checkout@master
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
Copyright 2020 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+
// Hint: The channels are swapped in iCUE, so the first channel in iCUE is here channel 2
20+
#define DATA_PIN_CHANNEL_1 2 // For the monitor backlight
21+
#define DATA_PIN_CHANNEL_2 3
22+
23+
CRGB ledsChannel1[84];
24+
CRGB ledsChannel2[105];
25+
26+
CorsairLightingFirmware firmware = corsairLS100Firmware();
27+
FastLEDController ledController(true);
28+
CorsairLightingProtocolController cLP(&ledController, &firmware);
29+
CorsairLightingProtocolHID cHID(&cLP);
30+
31+
void setup() {
32+
FastLED.addLeds<NEOPIXEL, DATA_PIN_CHANNEL_1>(ledsChannel1, 84);
33+
FastLED.addLeds<NEOPIXEL, DATA_PIN_CHANNEL_2>(ledsChannel2, 105);
34+
ledController.addLEDs(0, ledsChannel1, 84);
35+
ledController.addLEDs(1, ledsChannel2, 105);
36+
ledController.onUpdateHook(0, []() {
37+
// gamma correction with gamma value 2.0. Use napplyGamma_video for other gamma values.
38+
CLP::gammaCorrection(&ledController, 0);
39+
//napplyGamma_video(ledsChannel1, 84, 2.2);
40+
});
41+
}
42+
43+
void loop() {
44+
cHID.update();
45+
46+
if (ledController.updateLEDs()) {
47+
FastLED.show();
48+
}
49+
}

0 commit comments

Comments
 (0)