Skip to content

Commit b113fd8

Browse files
Update RGBController documentation
1 parent 1836b5e commit b113fd8

1 file changed

Lines changed: 105 additions & 7 deletions

File tree

Documentation/RGBControllerAPI.md

Lines changed: 105 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ The RGBController files for a controller implementation are kept in the Controll
7373
The RGBController class specification contains the following:
7474

7575
* Device Name
76+
* Device Vendor
7677
* Device Description
7778
* Device Version
7879
* Device Serial
@@ -83,6 +84,8 @@ The RGBController class specification contains the following:
8384
* Vector of Colors (32-bit 0x00BBGGRR format)
8485
* Device Type (enum)
8586
* Active mode index
87+
* Vector of LED Alternate Names
88+
* Controller Flags
8689

8790
### Device Types
8891

@@ -107,7 +110,23 @@ The RGBController class specification contains the following:
107110
| 16 | Microphone |
108111
| 17 | Accessory |
109112
| 18 | Keypad |
110-
| 19 | Unknown |
113+
| 19 | Laptop |
114+
| 20 | Monitor |
115+
| 21 | Unknown |
116+
117+
Additional device types may be added in the future. They are added after the last known device type. Anything out of range should be considered Unknown.
118+
119+
### Controller Flags
120+
121+
| Controller Flags Bit | Name | Description |
122+
| -------------------- | ------- | --------------------------------------------------- |
123+
| 0 | Local | Controller is provided by this OpenRGB instance |
124+
| 1 | Remote | Controller is provided by a remote OpenRGB instance |
125+
| 2 | Virtual | Controller is virtual (not a physical device) |
126+
127+
### LED Alternate Names
128+
129+
The LED Altrernate Names vector can override the base name of an LED. The intended use case for this field is providing regional key names for non-English keyboard layouts. The base key names should always be provided in English QWERYY layout for positional mapping to work on certain SDK applications, so the alternate names field can override the base name to provide the correct key name for the localized layout without disrupting SDK application mapping. If not overriding any LED names, this vector can be left empty. If only overriding certain LED names, those not being overridden can be empty strings. If used, the length of this vector must equal the length of the LEDs vector.
111130

112131
## LEDs
113132

@@ -131,10 +150,12 @@ The Zone structure contains information about a zone. A zone is a logical group
131150
* Minimum number of LEDs
132151
* Maximum number of LEDs
133152
* Matrix map pointer
153+
* Vector of segments
154+
* Zone Flags
134155

135156
The LED pointer and Color pointer point to the first LED/Color in the RGBController's LEDs/Colors vector associated with this zone. The Start Index is the index to the same LED/Color in the vectors.
136157

137-
The LED count is the number of LEDs in the zone. For zones with a fixed number of LEDs, the count, min, and max values should all be equal. For zones with a user-adjustable number of LEDs, the count should be between the min and max values, inclusively. User-adjustable zones are most commonly used to represent addressable RGB (ARGB) controllers as the number of LEDs depends on what strips/devices are attached to the ARGB headers. The ResizeZone function in the RGBController API is used to resize the number of LEDs in the zone.
158+
The LED count is the number of LEDs in the zone. For zones with a fixed number of LEDs, the count, min, and max values should all be equal. For zones with a user-adjustable number of LEDs, the count should be between the min and max values, inclusively. User-adjustable zones are most commonly used to represent addressable RGB (ARGB) controllers as the number of LEDs depends on what strips/devices are attached to the ARGB headers. The ResizeZone function in the RGBController API is used to resize the number of LEDs in the zone. The initial value should be zero for ARGB zones if the device does not provide a means to automatically determint the number of connected LEDs.
138159

139160
### Zone Types
140161

@@ -158,6 +179,27 @@ A matrix map has the following:
158179

159180
The height and width determine the size of the map data. The map data pointer should point to a data block of (Height * Width) unsigned 32-bit integers. This data can be accessed as if it were a Map[Y][X] 2D array. The values of the map are LED index values in the zone (so offset by Start Index from the RGBController's LEDs vector). If a spot in the matrix is unused and does not map to an LED, it should be set to 0xFFFFFFFF.
160181

182+
### Segments
183+
184+
Each Zone contains a vector of Segments. Segments can be used to divide a physical zone (such as an ARGB header) into multiple logical sub-zones, or segments. This is mainly used for ARGB zones with multiple components daisy-chained together. For example, segments can be used to group multiple rings on an ARGB fan or multiple daisy-chained fans connected to one header. If the device is capable of automatically detecting multiple components connected to a single output, the RGBController may create segments automatically during zone creation. Otherwise, leaving this vector empty will indicate that the zone contains no segments, though resizable zones allow the user to define their own segments.
185+
186+
A segment contains the following:
187+
188+
* Segment Name
189+
* Segment Type (See Zone Type values)
190+
* Start Index
191+
* LED Count
192+
193+
The Start Index is the index within the Zone where the Segment starts. The LED Count is the number of LEDs in the Segment. Care should be taken to ensure that the total number of LEDs across all segments equals the number of LEDs in the Zone and the start indices do not overlap.
194+
195+
### Zone Flags
196+
197+
The Zone Flags field is a bitfield with informational flags related to the Zone.
198+
199+
| Zone Flags Bit | Name | Description |
200+
| -------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
201+
| 0 | Resize Effects Only | This zone is resizable, but the size is only used for effects modes. The zone is treated as a single LED in the Colors vector for per-LED modes |
202+
161203
## Modes
162204

163205
Modes represent internal effects and have a name field that describes the effect. The mode's index in the vector is its ID. The Active Mode variable in the RGBController class specifies which mode is currently selected. A mode contains the following:
@@ -202,26 +244,82 @@ The mode minimum and maximum number of colors fields should be used if the mode
202244

203245
## Functions
204246

247+
### `std::string GetName()`
248+
249+
Returns the `name` string of the device.
250+
251+
### `std::string GetVendor()`
252+
253+
Returns the `vendor` string of the device.
254+
255+
### `std::string GetDescription()`
256+
257+
Returns the `description` string of the device.
258+
259+
### `std::string GetVersion()`
260+
261+
Returns the `version` string of the device.
262+
263+
### `std::string GetSerial()`
264+
265+
Returns the `serial` string of the device.
266+
267+
### `std::string GetLocation()`
268+
269+
Returns the `location` string of the device.
270+
271+
### `std::string GetModeName(int mode)`
272+
273+
Returns the `name` string of the given mode in the `modes` vector.
274+
275+
### `std::string GetZoneName(int zone)`
276+
277+
Returns the `name` string of the given zone in the `zones` vector.
278+
279+
### `std::string GetLEDName(int led)`
280+
281+
Returns the `name` string of the given LED in the `leds` vector.
282+
283+
### `RGBColor GetLED(unsigned int led)`
284+
285+
Returns the color value of the given LED in the `colors` vector.
286+
287+
### `void SetLED(unsigned int led, RGBColor color)`
288+
289+
Sets the color value of the given LED in the `colors` vector.
290+
291+
### `void SetAllLEDs(RGBColor color)`
292+
293+
Sets the color value of all LEDs in the `colors` vector.
294+
295+
### `void SetAllZoneLEDs(int zone, RGBColor color)`
296+
297+
Sets the color value of all LEDs in the given zone in the `colors` vector.
298+
205299
### `int GetMode()`
206300

207-
Returns the currently enabled mode of the device. The returned int should line up with the Modes vector.
301+
Returns the active mode index of the device. The returned int should line up with the `modes` vector.
208302

209303
### `void SetMode(int mode)`
210304

211-
Sets the mode of the device. The mode should be the index in the Modes vector of the mode you wish to set.
305+
Sets the active mode index of the device. The mode should be the index in the `modes` vector of the mode you wish to set.
212306

213307
### `void SetCustomMode()`
214308

215309
When called, the device should be put into its software-controlled mode. This differs between devices, but generally devices have a direct control or static effect mode. Ideally, this mode should not save to the device's internal Flash. This function sets up a device for software effect control.
216310

217311
### `void UpdateLEDs()`
218312

219-
Update all LEDs based on the device's `colors` vector.
313+
Update all LEDs based on the `colors` vector.
220314

221315
### `void UpdateZoneLEDs(int zone)`
222316

223-
Update all LEDs in the given zone based on the device's `colors` vector.
317+
Update all LEDs in the given zone based on the `colors` vector.
224318

225319
### `void UpdateSingleLED(int led)`
226320

227-
Update a single LED based on the device's `colors` vector.
321+
Update a single LED based on the `colors` vector.
322+
323+
### `void UpdateMode()`
324+
325+
Update the mode based on the active mode index and the `modes` vector.

0 commit comments

Comments
 (0)