|
| 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 | +#define NUMBER_OF_LEDS_PER_FAN 8 |
| 20 | + |
| 21 | +#define DATA_PIN_FAN_1 2 |
| 22 | +#define DATA_PIN_FAN_2 3 |
| 23 | +#define DATA_PIN_FAN_3 4 |
| 24 | +#define DATA_PIN_FAN_4 5 |
| 25 | +#define DATA_PIN_FAN_5 6 |
| 26 | +#define DATA_PIN_FAN_6 7 |
| 27 | +#define DATA_PIN_CHANNEL_2 8 |
| 28 | + |
| 29 | +CRGB ledsChannel1[96]; |
| 30 | +CRGB ledsChannel2[96]; |
| 31 | + |
| 32 | +CorsairLightingFirmware firmware = corsairLightingNodePROFirmware(); |
| 33 | +FastLEDController ledController(true); |
| 34 | +CorsairLightingProtocolController cLP(&ledController, &firmware); |
| 35 | +CorsairLightingProtocolHID cHID(&cLP); |
| 36 | + |
| 37 | +void setup() { |
| 38 | + // 6 fans on channel 1 |
| 39 | + // FAN_PIN CRGB array offset number of leds per fan |
| 40 | + FastLED.addLeds<WS2812B, DATA_PIN_FAN_1, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN * 0, NUMBER_OF_LEDS_PER_FAN); |
| 41 | + FastLED.addLeds<WS2812B, DATA_PIN_FAN_2, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN * 1, NUMBER_OF_LEDS_PER_FAN); |
| 42 | + FastLED.addLeds<WS2812B, DATA_PIN_FAN_3, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN * 2, NUMBER_OF_LEDS_PER_FAN); |
| 43 | + FastLED.addLeds<WS2812B, DATA_PIN_FAN_4, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN * 3, NUMBER_OF_LEDS_PER_FAN); |
| 44 | + FastLED.addLeds<WS2812B, DATA_PIN_FAN_5, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN * 4, NUMBER_OF_LEDS_PER_FAN); |
| 45 | + FastLED.addLeds<WS2812B, DATA_PIN_FAN_6, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN * 5, NUMBER_OF_LEDS_PER_FAN); |
| 46 | + |
| 47 | + // normal strip on channel 2 |
| 48 | + FastLED.addLeds<WS2812B, DATA_PIN_CHANNEL_2, GRB>(ledsChannel2, 96); |
| 49 | + ledController.addLEDs(0, ledsChannel1, 96); |
| 50 | + ledController.addLEDs(1, ledsChannel2, 96); |
| 51 | +} |
| 52 | + |
| 53 | +void loop() { |
| 54 | + cHID.update(); |
| 55 | + |
| 56 | + if (ledController.updateLEDs()) { |
| 57 | + FastLED.show(); |
| 58 | + } |
| 59 | +} |
0 commit comments