← Documents Documentation/leds/leds-blinkm.rst GitHub 원문 ↗

Linux 6.18.37 · LEDs

LEDs BlinkM Driver

I2C BlinkM RGB module의 multicolor, 색상별 LED class, 확장 sysfs 제어 interface입니다.

Source pathDocumentation/leds/leds-blinkm.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

leds-blinkm.rst:1-107

BlinkM driver는 I2C RGB module을 multicolor class, 색상별 LED class, device-specific sysfs group이라는 세 interface로 노출합니다.

공통 밝기와 RGB intensity를 함께 조절하거나, red·green·blue에 독립 trigger를 붙이고 test sequence를 실행할 수 있습니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 ==================
2 Leds BlinkM driver
3 ==================
4
5 The leds-blinkm driver supports the devices of the BlinkM family.
6
7 They are RGB-LED modules driven by a (AT)tiny microcontroller and
8 communicate through I2C. The default address of these modules is
9 0x09 but this can be changed through a command. By this you could
10 daisy-chain up to 127 BlinkMs on an I2C bus.
11
12 The device accepts RGB and HSB color values through separate commands.
13 Also you can store blinking sequences as "scripts" in
14 the controller and run them. Also fading is an option.
15
16 The interface this driver provides is 3-fold:
17
18 a) LED multicolor class interface for use with triggers
19 #######################################################
20
21 The registration follows the scheme::
22
23 blinkm-<i2c-bus-nr>-<i2c-device-nr>:rgb:indicator
24
25 $ ls -h /sys/class/leds/blinkm-1-9:rgb:indicator
26 brightness device max_brightness multi_index multi_intensity power subsystem trigger uevent
27
28 Hue is controlled by the multi_intensity file and lightness is controlled by
29 the brightness file.
30
31 The order in which to write the intensity values can be found in multi_index.
32 Exactly three values between 0 and 255 must be written to multi_intensity to
33 change the color::
34
35 $ echo 255 100 50 > multi_intensity
36
37 The overall lightness be changed by writing a value between 0 and 255 to the
38 brightness file.
39
40 b) LED class interface for use with triggers
41 ############################################
42
43 The registration follows the scheme::
44
45 blinkm-<i2c-bus-nr>-<i2c-device-nr>-<color>
46
47 $ ls -h /sys/class/leds/blinkm-6-*
48 /sys/class/leds/blinkm-6-9-blue:
49 brightness device max_brightness power subsystem trigger uevent
50
51 /sys/class/leds/blinkm-6-9-green:
52 brightness device max_brightness power subsystem trigger uevent
53
54 /sys/class/leds/blinkm-6-9-red:
55 brightness device max_brightness power subsystem trigger uevent
56
57 (same is /sys/bus/i2c/devices/6-0009/leds)
58
59 We can control the colors separated into red, green and blue and
60 assign triggers on each color.
61
62 E.g.::
63
64 $ cat blinkm-6-9-blue/brightness
65 05
66
67 $ echo 200 > blinkm-6-9-blue/brightness
68 $
69
70 $ modprobe ledtrig-heartbeat
71 $ echo heartbeat > blinkm-6-9-green/trigger
72 $
73
74
75 b) Sysfs group to control rgb, fade, hsb, scripts ...
76 #####################################################
77
78 This extended interface is available as folder blinkm
79 in the sysfs folder of the I2C device.
80 E.g. below /sys/bus/i2c/devices/6-0009/blinkm
81
82 $ ls -h /sys/bus/i2c/devices/6-0009/blinkm/
83 blue green red test
84
85 Currently supported is just setting red, green, blue
86 and a test sequence.
87
88 E.g.::
89
90 $ cat *
91 00
92 00
93 00
94 #Write into test to start test sequence!#
95
96 $ echo 1 > test
97 $
98
99 $ echo 255 > red
100 $
101
102
103
104 as of 07/2024
105
106 dl9pf <at> gmx <dot> de
107 jstrauss <at> mailbox <dot> org
108

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

BlinkM과 multicolor interface

1-45

`leds-blinkm` driver는 BlinkM family device를 지원합니다. 이 device는 (AT)tiny microcontroller가 구동하는 RGB LED module이며 I2C로 통신합니다. 기본 address는 `0x09`이고 command로 바꿀 수 있어 I2C bus 하나에 최대 127개 BlinkM을 daisy-chain할 수 있습니다.

Controller는 별도 command로 RGB와 HSB color 값을 받고, blinking sequence를 script로 저장해 실행할 수 있으며 fading도 지원합니다. Driver는 세 종류의 interface를 제공합니다.

첫 번째는 trigger와 함께 사용하는 LED multicolor class입니다. Device 이름은 `blinkm-<i2c-bus-nr>-<i2c-device-nr>:rgb:indicator` 형식이고, sysfs에는 `brightness`, `max_brightness`, `multi_index`, `multi_intensity`, `trigger` 등이 나타납니다.

Hue는 `multi_intensity`, 전체 lightness는 `brightness`가 제어합니다. `multi_index`에서 component 작성 순서를 확인한 뒤 `multi_intensity`에 0에서 255 사이 값 정확히 세 개를 씁니다. 예시는 `$ echo 255 100 50 > multi_intensity`입니다.

전체 lightness는 `brightness` file에 0에서 255 사이 값을 써서 변경합니다.

BlinkM multicolor attribute
Attribute역할
`multi_index`세 intensity 값의 color 순서 확인
`multi_intensity`0~255 범위 RGB component 세 개 설정
`brightness`0~255 범위 전체 lightness 설정
`trigger`LED trigger 연결

RGB component와 전체 밝기를 분리해 제어합니다.

==================
Leds BlinkM driver
==================

The leds-blinkm driver supports the devices of the BlinkM family.

They are RGB-LED modules driven by a (AT)tiny microcontroller and
communicate through I2C. The default address of these modules is
0x09 but this can be changed through a command. By this you could
daisy-chain up to 127 BlinkMs on an I2C bus.

The device accepts RGB and HSB color values through separate commands.
Also you can store blinking sequences as "scripts" in
the controller and run them. Also fading is an option.

The interface this driver provides is 3-fold:

a) LED multicolor class interface for use with triggers
#######################################################

The registration follows the scheme::

  blinkm-<i2c-bus-nr>-<i2c-device-nr>:rgb:indicator

  $ ls -h /sys/class/leds/blinkm-1-9:rgb:indicator
  brightness  device  max_brightness  multi_index  multi_intensity  power  subsystem  trigger  uevent

Hue is controlled by the multi_intensity file and lightness is controlled by
the brightness file.

The order in which to write the intensity values can be found in multi_index.
Exactly three values between 0 and 255 must be written to multi_intensity to
change the color::

  $ echo 255 100 50 > multi_intensity

The overall lightness be changed by writing a value between 0 and 255 to the
brightness file.

b) LED class interface for use with triggers
############################################

The registration follows the scheme::

  blinkm-<i2c-bus-nr>-<i2c-device-nr>-<color>

색상별 LED class interface

46-76

두 번째는 trigger와 함께 사용하는 일반 LED class interface입니다. 이름은 `blinkm-<i2c-bus-nr>-<i2c-device-nr>-<color>` 형식이며 red, green, blue가 각각 독립적인 `/sys/class/leds/` entry로 등록됩니다.

같은 entry는 I2C device의 `leds` directory에서도 확인할 수 있습니다. 각 color를 분리해 밝기를 제어하고 color마다 서로 다른 trigger를 지정할 수 있습니다.

예제는 blue `brightness`를 읽고 `200`으로 바꿉니다. 이어 `ledtrig-heartbeat` module을 load한 뒤 green channel의 `trigger`에 `heartbeat`를 써서 해당 color에 heartbeat trigger를 연결합니다.

색상별 trigger 설정
`/sys/class/leds/blinkm-<bus>-<addr>-<color>` 선택`brightness`로 해당 color intensity 설정필요한 `ledtrig-*` module load`trigger` attribute에 trigger 이름 기록

개별 LED class entry 하나에 trigger를 연결하는 절차입니다.


  $ ls -h /sys/class/leds/blinkm-6-*
  /sys/class/leds/blinkm-6-9-blue:
  brightness  device  max_brightness  power  subsystem  trigger  uevent

  /sys/class/leds/blinkm-6-9-green:
  brightness  device  max_brightness  power  subsystem  trigger  uevent

  /sys/class/leds/blinkm-6-9-red:
  brightness  device  max_brightness  power  subsystem  trigger  uevent

(same is /sys/bus/i2c/devices/6-0009/leds)

We can control the colors separated into red, green and blue and
assign triggers on each color.

E.g.::

  $ cat blinkm-6-9-blue/brightness
  05

  $ echo 200 > blinkm-6-9-blue/brightness
  $

  $ modprobe ledtrig-heartbeat
  $ echo heartbeat > blinkm-6-9-green/trigger
  $


b) Sysfs group to control rgb, fade, hsb, scripts ...
#####################################################

확장 BlinkM sysfs group

77-107

세 번째는 RGB, fade, HSB, script 등을 제어하기 위한 확장 sysfs group입니다. I2C device의 sysfs directory 아래 `blinkm` folder로 제공되며 예제 path는 `/sys/bus/i2c/devices/6-0009/blinkm`입니다.

현재 지원되는 항목은 `red`, `green`, `blue` 설정과 test sequence입니다. Directory에는 `blue`, `green`, `red`, `test` file이 나타납니다.

각 color file은 channel 값을 표시하거나 설정합니다. `test`에 값을 쓰면 test sequence를 시작하고, 예를 들어 `$ echo 255 > red`는 red channel을 최댓값으로 설정합니다.

BlinkM 확장 sysfs file
File동작
`red`Red channel 값 읽기·쓰기
`green`Green channel 값 읽기·쓰기
`blue`Blue channel 값 읽기·쓰기
`test`Test sequence 시작

2024년 7월 기준으로 문서화된 기능입니다.

문서의 기준 시점은 07/2024이며, 작성자 연락처는 원문 마지막에 보존되어 있습니다.


This extended interface is available as folder blinkm
in the sysfs folder of the I2C device.
E.g. below /sys/bus/i2c/devices/6-0009/blinkm

  $ ls -h /sys/bus/i2c/devices/6-0009/blinkm/
  blue  green  red  test

Currently supported is just setting red, green, blue
and a test sequence.

E.g.::

  $ cat *
  00
  00
  00
  #Write into test to start test sequence!#

  $ echo 1 > test
  $

  $ echo 255 > red
  $



as of 07/2024

dl9pf <at> gmx <dot> de
jstrauss <at> mailbox <dot> org