Skip to content

Commit 422f5b7

Browse files
Jean-Michel HautboisJonathan Corbet
authored andcommitted
Documentation: leds: improve readibility of multicolor doc
When reading the documentation of multicolor leds, the HTML output is not easy to read. Improve it by adding a few markups, splitting the console in a dedicated block. Signed-off-by: Jean-Michel Hautbois <[email protected]> Signed-off-by: Jonathan Corbet <[email protected]> Message-ID: <[email protected]>
1 parent 8f82b56 commit 422f5b7

File tree

1 file changed

+51
-31
lines changed

1 file changed

+51
-31
lines changed

Documentation/leds/leds-class-multicolor.rst

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,69 +18,89 @@ array. These files are children under the LED parent node created by the
1818
led_class framework. The led_class framework is documented in led-class.rst
1919
within this documentation directory.
2020

21-
Each colored LED will be indexed under the multi_* files. The order of the
22-
colors will be arbitrary. The multi_index file can be read to determine the
21+
Each colored LED will be indexed under the ``multi_*`` files. The order of the
22+
colors will be arbitrary. The ``multi_index`` file can be read to determine the
2323
color name to indexed value.
2424

25-
The multi_index file is an array that contains the string list of the colors as
26-
they are defined in each multi_* array file.
25+
The ``multi_index`` file is an array that contains the string list of the colors as
26+
they are defined in each ``multi_*`` array file.
2727

28-
The multi_intensity is an array that can be read or written to for the
28+
The ``multi_intensity`` is an array that can be read or written to for the
2929
individual color intensities. All elements within this array must be written in
3030
order for the color LED intensities to be updated.
3131

3232
Directory Layout Example
3333
========================
34-
root:/sys/class/leds/multicolor:status# ls -lR
35-
-rw-r--r-- 1 root root 4096 Oct 19 16:16 brightness
36-
-r--r--r-- 1 root root 4096 Oct 19 16:16 max_brightness
37-
-r--r--r-- 1 root root 4096 Oct 19 16:16 multi_index
38-
-rw-r--r-- 1 root root 4096 Oct 19 16:16 multi_intensity
34+
.. code-block:: console
35+
36+
root:/sys/class/leds/multicolor:status# ls -lR
37+
-rw-r--r-- 1 root root 4096 Oct 19 16:16 brightness
38+
-r--r--r-- 1 root root 4096 Oct 19 16:16 max_brightness
39+
-r--r--r-- 1 root root 4096 Oct 19 16:16 multi_index
40+
-rw-r--r-- 1 root root 4096 Oct 19 16:16 multi_intensity
41+
42+
..
3943
4044
Multicolor Class Brightness Control
4145
===================================
4246
The brightness level for each LED is calculated based on the color LED
4347
intensity setting divided by the global max_brightness setting multiplied by
4448
the requested brightness.
4549

46-
led_brightness = brightness * multi_intensity/max_brightness
50+
``led_brightness = brightness * multi_intensity/max_brightness``
4751

4852
Example:
4953
A user first writes the multi_intensity file with the brightness levels
5054
for each LED that are necessary to achieve a certain color output from a
5155
multicolor LED group.
5256

53-
cat /sys/class/leds/multicolor:status/multi_index
54-
green blue red
57+
.. code-block:: console
58+
59+
# cat /sys/class/leds/multicolor:status/multi_index
60+
green blue red
5561
56-
echo 43 226 138 > /sys/class/leds/multicolor:status/multi_intensity
62+
# echo 43 226 138 > /sys/class/leds/multicolor:status/multi_intensity
5763
58-
red -
59-
intensity = 138
60-
max_brightness = 255
61-
green -
62-
intensity = 43
63-
max_brightness = 255
64-
blue -
65-
intensity = 226
66-
max_brightness = 255
64+
red -
65+
intensity = 138
66+
max_brightness = 255
67+
green -
68+
intensity = 43
69+
max_brightness = 255
70+
blue -
71+
intensity = 226
72+
max_brightness = 255
73+
74+
..
6775
6876
The user can control the brightness of that multicolor LED group by writing the
6977
global 'brightness' control. Assuming a max_brightness of 255 the user
7078
may want to dim the LED color group to half. The user would write a value of
7179
128 to the global brightness file then the values written to each LED will be
7280
adjusted base on this value.
7381

74-
cat /sys/class/leds/multicolor:status/max_brightness
75-
255
76-
echo 128 > /sys/class/leds/multicolor:status/brightness
82+
.. code-block:: console
83+
84+
# cat /sys/class/leds/multicolor:status/max_brightness
85+
255
86+
# echo 128 > /sys/class/leds/multicolor:status/brightness
7787
78-
adjusted_red_value = 128 * 138/255 = 69
79-
adjusted_green_value = 128 * 43/255 = 21
80-
adjusted_blue_value = 128 * 226/255 = 113
88+
..
89+
90+
.. code-block:: none
91+
92+
adjusted_red_value = 128 * 138/255 = 69
93+
adjusted_green_value = 128 * 43/255 = 21
94+
adjusted_blue_value = 128 * 226/255 = 113
95+
96+
..
8197
8298
Reading the global brightness file will return the current brightness value of
8399
the color LED group.
84100

85-
cat /sys/class/leds/multicolor:status/brightness
86-
128
101+
.. code-block:: console
102+
103+
# cat /sys/class/leds/multicolor:status/brightness
104+
128
105+
106+
..

0 commit comments

Comments
 (0)