Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
lp50xx.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Seagate Technology LLC
3 * Copyright (c) 2022 Grinn
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8
9#ifndef ZEPHYR_INCLUDE_DRIVERS_LED_LP50XX_H_
10#define ZEPHYR_INCLUDE_DRIVERS_LED_LP50XX_H_
11
12#define LP50XX_COLORS_PER_LED 3
13
14#define LP5009_MAX_LEDS 3
15#define LP5012_MAX_LEDS 4
16#define LP5018_MAX_LEDS 6
17#define LP5024_MAX_LEDS 8
18#define LP5030_MAX_LEDS 10
19#define LP5036_MAX_LEDS 12
20
21/*
22 * LED channels mapping.
23 */
24
25/* Bank channels */
26#define LP50XX_BANK_CHAN_BASE 0
27#define LP50XX_BANK_BRIGHT_CHAN LP50XX_BANK_CHAN_BASE
28#define LP50XX_BANK_COL1_CHAN(led) (LP50XX_BANK_CHAN_BASE + 1)
29#define LP50XX_BANK_COL2_CHAN(led) (LP50XX_BANK_CHAN_BASE + 2)
30#define LP50XX_BANK_COL3_CHAN(led) (LP50XX_BANK_CHAN_BASE + 3)
31
32/* LED brightness channels. */
33#define LP50XX_LED_BRIGHT_CHAN_BASE 4
34#define LP50XX_LED_BRIGHT_CHAN(led) (LP50XX_LED_BRIGHT_CHAN_BASE + led)
35
36/*
37 * LED color channels.
38 *
39 * Each channel definition is compatible with the following chips:
40 * - LP5012_XXX => LP5009 / LP5012
41 * - LP5024_XXX => LP5018 / LP5024
42 * - LP5036_XXX => LP5030 / LP5036
43 */
44#define LP5012_LED_COL_CHAN_BASE 8
45#define LP5012_LED_COL1_CHAN(led) \
46 (LP5012_LED_COL_CHAN_BASE + led * LP50XX_COLORS_PER_LED)
47#define LP5012_LED_COL2_CHAN(led) \
48 (LP5012_LED_COL_CHAN_BASE + led * LP50XX_COLORS_PER_LED + 1)
49#define LP5012_LED_COL3_CHAN(led) \
50 (LP5012_LED_COL_CHAN_BASE + led * LP50XX_COLORS_PER_LED + 2)
51
52#define LP5024_LED_COL_CHAN_BASE 12
53#define LP5024_LED_COL1_CHAN(led) \
54 (LP5024_LED_COL_CHAN_BASE + led * LP50XX_COLORS_PER_LED)
55#define LP5024_LED_COL2_CHAN(led) \
56 (LP5024_LED_COL_CHAN_BASE + led * LP50XX_COLORS_PER_LED + 1)
57#define LP5024_LED_COL3_CHAN(led) \
58 (LP5024_LED_COL_CHAN_BASE + led * LP50XX_COLORS_PER_LED + 2)
59
60#define LP5036_LED_COL_CHAN_BASE 16
61#define LP5036_LED_COL1_CHAN(led) \
62 (LP5036_LED_COL_CHAN_BASE + led * LP50XX_COLORS_PER_LED)
63#define LP5036_LED_COL2_CHAN(led) \
64 (LP5036_LED_COL_CHAN_BASE + led * LP50XX_COLORS_PER_LED + 1)
65#define LP5036_LED_COL3_CHAN(led) \
66 (LP5036_LED_COL_CHAN_BASE + led * LP50XX_COLORS_PER_LED + 2)
67
68#endif /* ZEPHYR_INCLUDE_DRIVERS_LED_LP50XX_H_ */