PCA9555 / PCAL9555A Driver
API reference
Loading...
Searching...
No Matches
pcal95555_kconfig.hpp
Go to the documentation of this file.
1
6#pragma once
7// NOLINTBEGIN(cppcoreguidelines-macro-usage) - Kconfig macros for ESP-IDF integration
8
9/* Under ESP-IDF the CONFIG_* values live in sdkconfig.h; pull it in so InitFromConfig() sees the
10 * menuconfig choices and not only the defaults below. */
11#if defined(__has_include)
12#if __has_include("sdkconfig.h")
13#include "sdkconfig.h"
14#endif
15#endif
16
17/* Kconfig writes a bool option that is set to "n" as an absent macro, not as 0. When the component's
18 * Kconfig is in effect (CONFIG_PCAL95555 is defined by its top-level menu), an absent option therefore
19 * means 0, and the "default y" values below must not turn it back on. Without Kconfig (plain CMake,
20 * other platforms) the documented defaults apply. */
21#ifndef HF_PCAL95555_KCONFIG_DEFAULT_Y
22#if defined(CONFIG_PCAL95555)
23#define HF_PCAL95555_KCONFIG_DEFAULT_Y 0
24#else
25#define HF_PCAL95555_KCONFIG_DEFAULT_Y 1
26#endif
27#endif
28
29#ifndef CONFIG_PCAL95555_INIT_FROM_KCONFIG
30#define CONFIG_PCAL95555_INIT_FROM_KCONFIG HF_PCAL95555_KCONFIG_DEFAULT_Y
31#endif
32#ifndef CONFIG_PCAL95555_PORT0_OD
33#define CONFIG_PCAL95555_PORT0_OD 0
34#endif
35#ifndef CONFIG_PCAL95555_PORT1_OD
36#define CONFIG_PCAL95555_PORT1_OD 0
37#endif
38
39/* Per-pin direction defaults (1 = Input, 0 = Output) */
40#ifndef CONFIG_PCAL95555_P0_0_DIR
41#define CONFIG_PCAL95555_P0_0_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
42#endif
43#ifndef CONFIG_PCAL95555_P0_1_DIR
44#define CONFIG_PCAL95555_P0_1_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
45#endif
46#ifndef CONFIG_PCAL95555_P0_2_DIR
47#define CONFIG_PCAL95555_P0_2_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
48#endif
49#ifndef CONFIG_PCAL95555_P0_3_DIR
50#define CONFIG_PCAL95555_P0_3_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
51#endif
52#ifndef CONFIG_PCAL95555_P0_4_DIR
53#define CONFIG_PCAL95555_P0_4_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
54#endif
55#ifndef CONFIG_PCAL95555_P0_5_DIR
56#define CONFIG_PCAL95555_P0_5_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
57#endif
58#ifndef CONFIG_PCAL95555_P0_6_DIR
59#define CONFIG_PCAL95555_P0_6_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
60#endif
61#ifndef CONFIG_PCAL95555_P0_7_DIR
62#define CONFIG_PCAL95555_P0_7_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
63#endif
64#ifndef CONFIG_PCAL95555_P1_0_DIR
65#define CONFIG_PCAL95555_P1_0_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
66#endif
67#ifndef CONFIG_PCAL95555_P1_1_DIR
68#define CONFIG_PCAL95555_P1_1_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
69#endif
70#ifndef CONFIG_PCAL95555_P1_2_DIR
71#define CONFIG_PCAL95555_P1_2_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
72#endif
73#ifndef CONFIG_PCAL95555_P1_3_DIR
74#define CONFIG_PCAL95555_P1_3_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
75#endif
76#ifndef CONFIG_PCAL95555_P1_4_DIR
77#define CONFIG_PCAL95555_P1_4_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
78#endif
79#ifndef CONFIG_PCAL95555_P1_5_DIR
80#define CONFIG_PCAL95555_P1_5_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
81#endif
82#ifndef CONFIG_PCAL95555_P1_6_DIR
83#define CONFIG_PCAL95555_P1_6_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
84#endif
85#ifndef CONFIG_PCAL95555_P1_7_DIR
86#define CONFIG_PCAL95555_P1_7_DIR HF_PCAL95555_KCONFIG_DEFAULT_Y
87#endif
88
89/* Per-pin pull resistor enable defaults (1 = Enabled, 0 = Disabled) */
90#ifndef CONFIG_PCAL95555_P0_0_PULL
91#define CONFIG_PCAL95555_P0_0_PULL 0
92#endif
93#ifndef CONFIG_PCAL95555_P0_1_PULL
94#define CONFIG_PCAL95555_P0_1_PULL 0
95#endif
96#ifndef CONFIG_PCAL95555_P0_2_PULL
97#define CONFIG_PCAL95555_P0_2_PULL 0
98#endif
99#ifndef CONFIG_PCAL95555_P0_3_PULL
100#define CONFIG_PCAL95555_P0_3_PULL 0
101#endif
102#ifndef CONFIG_PCAL95555_P0_4_PULL
103#define CONFIG_PCAL95555_P0_4_PULL 0
104#endif
105#ifndef CONFIG_PCAL95555_P0_5_PULL
106#define CONFIG_PCAL95555_P0_5_PULL 0
107#endif
108#ifndef CONFIG_PCAL95555_P0_6_PULL
109#define CONFIG_PCAL95555_P0_6_PULL 0
110#endif
111#ifndef CONFIG_PCAL95555_P0_7_PULL
112#define CONFIG_PCAL95555_P0_7_PULL 0
113#endif
114#ifndef CONFIG_PCAL95555_P1_0_PULL
115#define CONFIG_PCAL95555_P1_0_PULL 0
116#endif
117#ifndef CONFIG_PCAL95555_P1_1_PULL
118#define CONFIG_PCAL95555_P1_1_PULL 0
119#endif
120#ifndef CONFIG_PCAL95555_P1_2_PULL
121#define CONFIG_PCAL95555_P1_2_PULL 0
122#endif
123#ifndef CONFIG_PCAL95555_P1_3_PULL
124#define CONFIG_PCAL95555_P1_3_PULL 0
125#endif
126#ifndef CONFIG_PCAL95555_P1_4_PULL
127#define CONFIG_PCAL95555_P1_4_PULL 0
128#endif
129#ifndef CONFIG_PCAL95555_P1_5_PULL
130#define CONFIG_PCAL95555_P1_5_PULL 0
131#endif
132#ifndef CONFIG_PCAL95555_P1_6_PULL
133#define CONFIG_PCAL95555_P1_6_PULL 0
134#endif
135#ifndef CONFIG_PCAL95555_P1_7_PULL
136#define CONFIG_PCAL95555_P1_7_PULL 0
137#endif
138
139/* Per-pin pull-up direction defaults (1 = Pull-Up, 0 = Pull-Down) */
140#ifndef CONFIG_PCAL95555_P0_0_PULL_UP
141#define CONFIG_PCAL95555_P0_0_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
142#endif
143#ifndef CONFIG_PCAL95555_P0_1_PULL_UP
144#define CONFIG_PCAL95555_P0_1_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
145#endif
146#ifndef CONFIG_PCAL95555_P0_2_PULL_UP
147#define CONFIG_PCAL95555_P0_2_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
148#endif
149#ifndef CONFIG_PCAL95555_P0_3_PULL_UP
150#define CONFIG_PCAL95555_P0_3_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
151#endif
152#ifndef CONFIG_PCAL95555_P0_4_PULL_UP
153#define CONFIG_PCAL95555_P0_4_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
154#endif
155#ifndef CONFIG_PCAL95555_P0_5_PULL_UP
156#define CONFIG_PCAL95555_P0_5_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
157#endif
158#ifndef CONFIG_PCAL95555_P0_6_PULL_UP
159#define CONFIG_PCAL95555_P0_6_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
160#endif
161#ifndef CONFIG_PCAL95555_P0_7_PULL_UP
162#define CONFIG_PCAL95555_P0_7_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
163#endif
164#ifndef CONFIG_PCAL95555_P1_0_PULL_UP
165#define CONFIG_PCAL95555_P1_0_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
166#endif
167#ifndef CONFIG_PCAL95555_P1_1_PULL_UP
168#define CONFIG_PCAL95555_P1_1_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
169#endif
170#ifndef CONFIG_PCAL95555_P1_2_PULL_UP
171#define CONFIG_PCAL95555_P1_2_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
172#endif
173#ifndef CONFIG_PCAL95555_P1_3_PULL_UP
174#define CONFIG_PCAL95555_P1_3_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
175#endif
176#ifndef CONFIG_PCAL95555_P1_4_PULL_UP
177#define CONFIG_PCAL95555_P1_4_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
178#endif
179#ifndef CONFIG_PCAL95555_P1_5_PULL_UP
180#define CONFIG_PCAL95555_P1_5_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
181#endif
182#ifndef CONFIG_PCAL95555_P1_6_PULL_UP
183#define CONFIG_PCAL95555_P1_6_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
184#endif
185#ifndef CONFIG_PCAL95555_P1_7_PULL_UP
186#define CONFIG_PCAL95555_P1_7_PULL_UP HF_PCAL95555_KCONFIG_DEFAULT_Y
187#endif
188
189/* Per-pin output defaults (1 = High, 0 = Low) */
190#ifndef CONFIG_PCAL95555_P0_0_OUTPUT
191#define CONFIG_PCAL95555_P0_0_OUTPUT 0
192#endif
193#ifndef CONFIG_PCAL95555_P0_1_OUTPUT
194#define CONFIG_PCAL95555_P0_1_OUTPUT 0
195#endif
196#ifndef CONFIG_PCAL95555_P0_2_OUTPUT
197#define CONFIG_PCAL95555_P0_2_OUTPUT 0
198#endif
199#ifndef CONFIG_PCAL95555_P0_3_OUTPUT
200#define CONFIG_PCAL95555_P0_3_OUTPUT 0
201#endif
202#ifndef CONFIG_PCAL95555_P0_4_OUTPUT
203#define CONFIG_PCAL95555_P0_4_OUTPUT 0
204#endif
205#ifndef CONFIG_PCAL95555_P0_5_OUTPUT
206#define CONFIG_PCAL95555_P0_5_OUTPUT 0
207#endif
208#ifndef CONFIG_PCAL95555_P0_6_OUTPUT
209#define CONFIG_PCAL95555_P0_6_OUTPUT 0
210#endif
211#ifndef CONFIG_PCAL95555_P0_7_OUTPUT
212#define CONFIG_PCAL95555_P0_7_OUTPUT 0
213#endif
214#ifndef CONFIG_PCAL95555_P1_0_OUTPUT
215#define CONFIG_PCAL95555_P1_0_OUTPUT 0
216#endif
217#ifndef CONFIG_PCAL95555_P1_1_OUTPUT
218#define CONFIG_PCAL95555_P1_1_OUTPUT 0
219#endif
220#ifndef CONFIG_PCAL95555_P1_2_OUTPUT
221#define CONFIG_PCAL95555_P1_2_OUTPUT 0
222#endif
223#ifndef CONFIG_PCAL95555_P1_3_OUTPUT
224#define CONFIG_PCAL95555_P1_3_OUTPUT 0
225#endif
226#ifndef CONFIG_PCAL95555_P1_4_OUTPUT
227#define CONFIG_PCAL95555_P1_4_OUTPUT 0
228#endif
229#ifndef CONFIG_PCAL95555_P1_5_OUTPUT
230#define CONFIG_PCAL95555_P1_5_OUTPUT 0
231#endif
232#ifndef CONFIG_PCAL95555_P1_6_OUTPUT
233#define CONFIG_PCAL95555_P1_6_OUTPUT 0
234#endif
235#ifndef CONFIG_PCAL95555_P1_7_OUTPUT
236#define CONFIG_PCAL95555_P1_7_OUTPUT 0
237#endif
238
239/* Derived port-level masks from per-pin options */
240#ifndef CONFIG_PCAL95555_PORT0_DIRECTION
241#define CONFIG_PCAL95555_PORT0_DIRECTION \
242 ((CONFIG_PCAL95555_P0_0_DIR << 0) | (CONFIG_PCAL95555_P0_1_DIR << 1) | \
243 (CONFIG_PCAL95555_P0_2_DIR << 2) | (CONFIG_PCAL95555_P0_3_DIR << 3) | \
244 (CONFIG_PCAL95555_P0_4_DIR << 4) | (CONFIG_PCAL95555_P0_5_DIR << 5) | \
245 (CONFIG_PCAL95555_P0_6_DIR << 6) | (CONFIG_PCAL95555_P0_7_DIR << 7))
246#endif
247#ifndef CONFIG_PCAL95555_PORT1_DIRECTION
248#define CONFIG_PCAL95555_PORT1_DIRECTION \
249 ((CONFIG_PCAL95555_P1_0_DIR << 0) | (CONFIG_PCAL95555_P1_1_DIR << 1) | \
250 (CONFIG_PCAL95555_P1_2_DIR << 2) | (CONFIG_PCAL95555_P1_3_DIR << 3) | \
251 (CONFIG_PCAL95555_P1_4_DIR << 4) | (CONFIG_PCAL95555_P1_5_DIR << 5) | \
252 (CONFIG_PCAL95555_P1_6_DIR << 6) | (CONFIG_PCAL95555_P1_7_DIR << 7))
253#endif
254#ifndef CONFIG_PCAL95555_PORT0_PULL_ENABLE
255#define CONFIG_PCAL95555_PORT0_PULL_ENABLE \
256 ((CONFIG_PCAL95555_P0_0_PULL << 0) | (CONFIG_PCAL95555_P0_1_PULL << 1) | \
257 (CONFIG_PCAL95555_P0_2_PULL << 2) | (CONFIG_PCAL95555_P0_3_PULL << 3) | \
258 (CONFIG_PCAL95555_P0_4_PULL << 4) | (CONFIG_PCAL95555_P0_5_PULL << 5) | \
259 (CONFIG_PCAL95555_P0_6_PULL << 6) | (CONFIG_PCAL95555_P0_7_PULL << 7))
260#endif
261#ifndef CONFIG_PCAL95555_PORT1_PULL_ENABLE
262#define CONFIG_PCAL95555_PORT1_PULL_ENABLE \
263 ((CONFIG_PCAL95555_P1_0_PULL << 0) | (CONFIG_PCAL95555_P1_1_PULL << 1) | \
264 (CONFIG_PCAL95555_P1_2_PULL << 2) | (CONFIG_PCAL95555_P1_3_PULL << 3) | \
265 (CONFIG_PCAL95555_P1_4_PULL << 4) | (CONFIG_PCAL95555_P1_5_PULL << 5) | \
266 (CONFIG_PCAL95555_P1_6_PULL << 6) | (CONFIG_PCAL95555_P1_7_PULL << 7))
267#endif
268#ifndef CONFIG_PCAL95555_PORT0_PULL_UP
269#define CONFIG_PCAL95555_PORT0_PULL_UP \
270 ((CONFIG_PCAL95555_P0_0_PULL_UP << 0) | (CONFIG_PCAL95555_P0_1_PULL_UP << 1) | \
271 (CONFIG_PCAL95555_P0_2_PULL_UP << 2) | (CONFIG_PCAL95555_P0_3_PULL_UP << 3) | \
272 (CONFIG_PCAL95555_P0_4_PULL_UP << 4) | (CONFIG_PCAL95555_P0_5_PULL_UP << 5) | \
273 (CONFIG_PCAL95555_P0_6_PULL_UP << 6) | (CONFIG_PCAL95555_P0_7_PULL_UP << 7))
274#endif
275#ifndef CONFIG_PCAL95555_PORT1_PULL_UP
276#define CONFIG_PCAL95555_PORT1_PULL_UP \
277 ((CONFIG_PCAL95555_P1_0_PULL_UP << 0) | (CONFIG_PCAL95555_P1_1_PULL_UP << 1) | \
278 (CONFIG_PCAL95555_P1_2_PULL_UP << 2) | (CONFIG_PCAL95555_P1_3_PULL_UP << 3) | \
279 (CONFIG_PCAL95555_P1_4_PULL_UP << 4) | (CONFIG_PCAL95555_P1_5_PULL_UP << 5) | \
280 (CONFIG_PCAL95555_P1_6_PULL_UP << 6) | (CONFIG_PCAL95555_P1_7_PULL_UP << 7))
281#endif
282#ifndef CONFIG_PCAL95555_PORT0_OUTPUT
283#define CONFIG_PCAL95555_PORT0_OUTPUT \
284 ((CONFIG_PCAL95555_P0_0_OUTPUT << 0) | (CONFIG_PCAL95555_P0_1_OUTPUT << 1) | \
285 (CONFIG_PCAL95555_P0_2_OUTPUT << 2) | (CONFIG_PCAL95555_P0_3_OUTPUT << 3) | \
286 (CONFIG_PCAL95555_P0_4_OUTPUT << 4) | (CONFIG_PCAL95555_P0_5_OUTPUT << 5) | \
287 (CONFIG_PCAL95555_P0_6_OUTPUT << 6) | (CONFIG_PCAL95555_P0_7_OUTPUT << 7))
288#endif
289#ifndef CONFIG_PCAL95555_PORT1_OUTPUT
290#define CONFIG_PCAL95555_PORT1_OUTPUT \
291 ((CONFIG_PCAL95555_P1_0_OUTPUT << 0) | (CONFIG_PCAL95555_P1_1_OUTPUT << 1) | \
292 (CONFIG_PCAL95555_P1_2_OUTPUT << 2) | (CONFIG_PCAL95555_P1_3_OUTPUT << 3) | \
293 (CONFIG_PCAL95555_P1_4_OUTPUT << 4) | (CONFIG_PCAL95555_P1_5_OUTPUT << 5) | \
294 (CONFIG_PCAL95555_P1_6_OUTPUT << 6) | (CONFIG_PCAL95555_P1_7_OUTPUT << 7))
295#endif
296
297#ifndef CONFIG_PCAL95555_INIT_DIRECTION
298#define CONFIG_PCAL95555_INIT_DIRECTION \
299 ((CONFIG_PCAL95555_PORT1_DIRECTION << 8) | CONFIG_PCAL95555_PORT0_DIRECTION)
300#endif
301#ifndef CONFIG_PCAL95555_INIT_PULL_ENABLE
302#define CONFIG_PCAL95555_INIT_PULL_ENABLE \
303 ((CONFIG_PCAL95555_PORT1_PULL_ENABLE << 8) | CONFIG_PCAL95555_PORT0_PULL_ENABLE)
304#endif
305#ifndef CONFIG_PCAL95555_INIT_PULL_UP
306#define CONFIG_PCAL95555_INIT_PULL_UP \
307 ((CONFIG_PCAL95555_PORT1_PULL_UP << 8) | CONFIG_PCAL95555_PORT0_PULL_UP)
308#endif
309#ifndef CONFIG_PCAL95555_INIT_OUTPUT
310#define CONFIG_PCAL95555_INIT_OUTPUT \
311 ((CONFIG_PCAL95555_PORT1_OUTPUT << 8) | CONFIG_PCAL95555_PORT0_OUTPUT)
312#endif
313#ifndef CONFIG_PCAL95555_INIT_OD_PORT0
314#define CONFIG_PCAL95555_INIT_OD_PORT0 CONFIG_PCAL95555_PORT0_OD
315#endif
316#ifndef CONFIG_PCAL95555_INIT_OD_PORT1
317#define CONFIG_PCAL95555_INIT_OD_PORT1 CONFIG_PCAL95555_PORT1_OD
318#endif
319
320// NOLINTEND(cppcoreguidelines-macro-usage)