Corsair Lighting Protocol  0.15.0
Control LEDs connected to an Arduino with iCUE
CorsairLightingProtocolConstants.h
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 #pragma once
17 
18 #include "Arduino.h"
19 
20 // CLP_DEBUG: 0=Off, 1=Error, 2=Warning, 3=Info, 4=Data
21 // CLP_DEBUG_BAUD: Setting too low will severely affect performance depending on debug level;
22 // 2000000 needed when CLP_DEBUG is 4
23 #define CLP_DEBUG 0
24 #define CLP_DEBUG_PORT Serial1
25 #define CLP_DEBUG_BAUD 115200
26 
27 #define COMMAND_SIZE 64
28 #define RESPONSE_SIZE 16
29 
30 #define READ_STATUS 0x01
31 #define READ_FIRMWARE_VERSION 0x02
32 #define READ_DEVICE_ID 0x03
33 #define WRITE_DEVICE_ID 0x04
34 #define START_FIRMWARE_UPDATE 0x05
35 #define READ_BOOTLOADER_VERSION 0x06
36 #define WRITE_TEST_FLAG 0x07
37 
38 #define READ_TEMPERATURE_MASK 0x10
39 #define READ_TEMPERATURE_VALUE 0x11
40 #define READ_VOLTAGE_VALUE 0x12
41 
42 #define READ_FAN_MASK 0x20
43 #define READ_FAN_SPEED 0x21
44 #define READ_FAN_POWER 0x22
45 #define WRITE_FAN_POWER 0x23
46 #define WRITE_FAN_SPEED 0x24
47 #define WRITE_FAN_CURVE 0x25
48 #define WRITE_FAN_EXTERNAL_TEMP 0x26
49 #define WRITE_FAN_FORCE_THREE_PIN_MODE 0x27
50 #define WRITE_FAN_DETECTION_TYPE 0x28
51 #define READ_FAN_DETECTION_TYPE 0x29
52 
53 #define READ_LED_STRIP_MASK 0x30
54 #define WRITE_LED_RGB_VALUE 0x31
55 #define WRITE_LED_COLOR_VALUES 0x32
56 #define WRITE_LED_TRIGGER 0x33
57 #define WRITE_LED_CLEAR 0x34
58 #define WRITE_LED_GROUP_SET 0x35
59 #define WRITE_LED_EXTERNAL_TEMP 0x36
60 #define WRITE_LED_GROUPS_CLEAR 0x37
61 #define WRITE_LED_MODE 0x38
62 #define WRITE_LED_BRIGHTNESS 0x39
63 #define WRITE_LED_COUNT 0x3A
64 #define WRITE_LED_PORT_TYPE 0x3B
65 #define WRITE_LED_START_AUTODETECTION 0x3C
66 #define READ_LED_AUTODETECTION_RESULTS 0x3D
67 
68 #define PROTOCOL_RESPONSE_OK 0x00
69 #define PROTOCOL_RESPONSE_ERROR 0x01
70 #define PROTOCOL_STATUS_OK 0x00
71 #define PROTOCOL_STATUS_ERROR 0xFF
72 
73 #ifndef SERIAL_NUMBER
74 #define SERIAL_NUMBER "FB66DF55421900F5"
75 #endif
76 
77 #define CORSAIR_MANUFACTURER "Corsair"
78 #define CORSAIR_VID 0x1B1C
79 #define CORSAIR_LNP_PRODUCT "Lighting Node PRO" // Antigua
80 #define CORSAIR_LNP_PID 0x0C0B
81 #define CORSAIR_CP_PRODUCT "Commander PRO" // Barbuda
82 #define CORSAIR_CP_PID 0x0C10
83 #define CORSAIR_LNC_PRODUCT "Lighting Node CORE" // Kauai
84 #define CORSAIR_LNC_PID 0x0C1A
85 #define CORSAIR_SLC_PRODUCT "Smart Lighting Controller" // Borealis
86 #define CORSAIR_SLC_PID 0x0C1E
87 #define CORSAIR_SLT_PRODUCT "Smart Lighting Towers" // Lightsabers
88 #define CORSAIR_SLT_PID 0x0C23
89 #define CORSAIR_CC_PRODUCT "CORSAIR iCUE Commander CORE"
90 #define CORSAIR_CC_PID 0x0C1C
91 
92 #define QL_FAN_LEDS 34
93 #define LL_FAN_LEDS 16
94 #define HD_FAN_LEDS 12
95 #define EIGHT_LED_FAN_LEDS 8
96 #define ML_PRO_FAN_LEDS 4
97 
98 #define LC100_LEDS 9
99 #define LC100_FIRST_LED_OFFSET 3
100 
101 typedef enum {
102  CORSAIR_LIGHTING_NODE_PRO = 0,
103  CORSAIR_COMMANDER_PRO,
104  CORSAIR_LIGHTING_NODE_CORE,
105  CORSAIR_SMART_LIGHTING_CONTROLLER,
106  CORSAIR_SMART_LIGHTING_TOWERS,
107  CORSAIR_COMMANDER_CORE // Currently not functional
108 } corsair_product_enum_t;
109 
110 struct Command {
111  union {
112  struct {
113  uint8_t command;
114  uint8_t data[COMMAND_SIZE - 1];
115  };
116  uint8_t raw[COMMAND_SIZE];
117  };
118 };
Definition: CorsairLightingProtocolConstants.h:110