File tree Expand file tree Collapse file tree 6 files changed +436
-0
lines changed
samples/drivers/led_lp503x Expand file tree Collapse file tree 6 files changed +436
-0
lines changed Original file line number Diff line number Diff line change 1+ # SPDX-License-Identifier: Apache-2.0
2+
3+ cmake_minimum_required (VERSION 3.13.1)
4+
5+ find_package (Zephyr HINTS $ENV{ZEPHYR_BASE} )
6+ project (led_lp503x)
7+
8+ FILE (GLOB app_sources src/*.c)
9+ target_sources (app PRIVATE ${app_sources} )
Original file line number Diff line number Diff line change 1+ .. _lp503x :
2+
3+ LP5030/6: 10 or 12 RGB channels
4+ ###############################
5+
6+ Overview
7+ ********
8+
9+ This sample controls up to 12 LEDs connected to a LP503x driver.
10+
11+ First, for each LED information is retrieved using the led_get_info syscall
12+ and printed in the log messages. Next, from an infinite loop, a test pattern
13+ (described below) is applied to all the LEDs simultaneously (using the
14+ led_write_channels syscall) and then to each LED one by one (using the
15+ led_set_{brightness,color} syscalls).
16+
17+ Test pattern
18+ ============
19+
20+ For all the LEDs first (using channel API) and then for each LED one by one:
21+
22+ For each color in red green blue white yellow purple cyan orange:
23+
24+ - set the color
25+ - turn on
26+ - turn off
27+ - set the brightness gradually to the maximum level
28+ - turn off
29+
30+ Building and Running
31+ ********************
32+
33+ This sample can be built and executed on boards with an I2C LP5030/6 LED driver
34+ connected. A node matching the "ti,lp503x" binding should be defined in the
35+ board DTS files.
36+
37+ As an example this sample provides a DTS overlay for the :ref: `lpcxpresso11u68 `
38+ board (:file: `boards/lpcxpresso11u68.overlay `). It assumes that a I2C LP5030
39+ LED driver (with 10 LEDs wired) is connected to the I2C0 bus at address 0x30.
40+
41+ References
42+ **********
43+
44+ - LP503x: https://www.ti.com/lit/ds/symlink/lp5036.pdf
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2020 Seagate Technology LLC
3+ *
4+ * SPDX-License-Identifier: Apache-2.0
5+ */
6+
7+ #include <dt-bindings/led/led.h>
8+
9+ &i2c0 {
10+ /* TI LP5030 LED controller connected to I2C0. */
11+ lp5030@30 {
12+ compatible = "ti,lp5030", "ti,lp503x";
13+ reg = <0x30>;
14+ label = "LP5030";
15+
16+ led_0 {
17+ label = "LED LP5030 0";
18+ index = <0>;
19+ color-mapping =
20+ <LED_COLOR_ID_RED>,
21+ <LED_COLOR_ID_GREEN>,
22+ <LED_COLOR_ID_BLUE>;
23+ };
24+ led_1 {
25+ label = "LED LP5030 1";
26+ index = <1>;
27+ color-mapping =
28+ <LED_COLOR_ID_RED>,
29+ <LED_COLOR_ID_GREEN>,
30+ <LED_COLOR_ID_BLUE>;
31+ };
32+ led_2 {
33+ label = "LED LP5030 2";
34+ index = <2>;
35+ color-mapping =
36+ <LED_COLOR_ID_RED>,
37+ <LED_COLOR_ID_GREEN>,
38+ <LED_COLOR_ID_BLUE>;
39+ };
40+ led_3 {
41+ label = "LED LP5030 3";
42+ index = <3>;
43+ color-mapping =
44+ <LED_COLOR_ID_RED>,
45+ <LED_COLOR_ID_GREEN>,
46+ <LED_COLOR_ID_BLUE>;
47+ };
48+ led_4 {
49+ label = "LED LP5030 4";
50+ index = <4>;
51+ color-mapping =
52+ <LED_COLOR_ID_RED>,
53+ <LED_COLOR_ID_GREEN>,
54+ <LED_COLOR_ID_BLUE>;
55+ };
56+ led_5 {
57+ label = "LED LP5030 5";
58+ index = <5>;
59+ color-mapping =
60+ <LED_COLOR_ID_RED>,
61+ <LED_COLOR_ID_GREEN>,
62+ <LED_COLOR_ID_BLUE>;
63+ };
64+ led_6 {
65+ label = "LED LP5030 6";
66+ index = <6>;
67+ color-mapping =
68+ <LED_COLOR_ID_RED>,
69+ <LED_COLOR_ID_GREEN>,
70+ <LED_COLOR_ID_BLUE>;
71+ };
72+ led_7 {
73+ label = "LED LP5030 7";
74+ index = <7>;
75+ color-mapping =
76+ <LED_COLOR_ID_RED>,
77+ <LED_COLOR_ID_GREEN>,
78+ <LED_COLOR_ID_BLUE>;
79+ };
80+ led_8 {
81+ label = "LED LP5030 8";
82+ index = <8>;
83+ color-mapping =
84+ <LED_COLOR_ID_RED>,
85+ <LED_COLOR_ID_GREEN>,
86+ <LED_COLOR_ID_BLUE>;
87+ };
88+ led_9 {
89+ label = "LED LP5030 9";
90+ index = <9>;
91+ color-mapping =
92+ <LED_COLOR_ID_RED>,
93+ <LED_COLOR_ID_GREEN>,
94+ <LED_COLOR_ID_BLUE>;
95+ };
96+ };
97+ };
Original file line number Diff line number Diff line change 1+ CONFIG_LOG=y
2+
3+ CONFIG_I2C=y
4+
5+ CONFIG_LED=y
6+ CONFIG_LP503X=y
Original file line number Diff line number Diff line change 1+ sample :
2+ description : Demonstration of the LP503x LED driver
3+ name : LP503x sample
4+ tests :
5+ sample.drivers.led.lp503x :
6+ filter : dt_compat_enabled("ti,lp503x")
7+ tags : LED
8+ depends_on : i2c
You can’t perform that action at this time.
0 commit comments