Loading...
Searching...
No Matches
pcf857x_params.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Gunar Schorcht
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
15
16#include "board.h"
17#include "pcf857x.h"
18#include "saul_reg.h"
19#include "saul/periph.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
29#ifndef PCF857X_PARAM_DEV
31#define PCF857X_PARAM_DEV I2C_DEV(0)
32#endif
33
34#ifndef PCF857X_PARAM_ADDR
36#define PCF857X_PARAM_ADDR (0)
37#endif
38
39#ifndef PCF857X_PARAM_EXP
41#if IS_USED(MODULE_PCF8575) || DOXYGEN
42#define PCF857X_PARAM_EXP (PCF857X_EXP_PCF8575)
43#elif IS_USED(MODULE_PCF8574)
44#define PCF857X_PARAM_EXP (PCF857X_EXP_PCF8574)
45#elif IS_USED(MODULE_PCF8574A)
46#define PCF857X_PARAM_EXP (PCF857X_EXP_PCF8574A)
47#endif
48#endif /* PCF857X_PARAM_EXP */
49
50#ifndef PCF857X_PARAM_INT_PIN
52#define PCF857X_PARAM_INT_PIN (GPIO_UNDEF)
53#endif
54
55#ifndef PCF857X_PARAMS
56#if IS_USED(MODULE_PCF857X_IRQ) || DOXYGEN
58#define PCF857X_PARAMS { \
59 .dev = PCF857X_PARAM_DEV, \
60 .addr = PCF857X_PARAM_ADDR, \
61 .exp = PCF857X_PARAM_EXP, \
62 .int_pin = PCF857X_PARAM_INT_PIN, \
63 },
64#else
65#define PCF857X_PARAMS { \
66 .dev = PCF857X_PARAM_DEV, \
67 .addr = PCF857X_PARAM_ADDR, \
68 .exp = PCF857X_PARAM_EXP, \
69 },
70#endif
71#endif /* PCF857X_PARAMS */
72
73#ifndef PCF857X_SAUL_GPIO_PARAMS
75#define PCF857X_SAUL_GPIO_PARAMS { \
76 .dev = 0, \
77 .gpio = { \
78 .name = "P00 Output", \
79 .pin = PCF857X_GPIO_PIN(0, 0), \
80 .mode = GPIO_OUT, \
81 .flags = SAUL_GPIO_INIT_CLEAR, \
82 } \
83 }, \
84 { \
85 .dev = 0, \
86 .gpio = { \
87 .name = "P01 Input", \
88 .pin = PCF857X_GPIO_PIN(0, 1), \
89 .mode = GPIO_IN, \
90 .flags = 0, \
91 } \
92 },
93#endif
95
100{
102};
103
104#if IS_USED(MODULE_SAUL_GPIO) || DOXYGEN
112#endif /* MODULE_SAUL_GPIO || DOXYGEN */
113
114#ifdef __cplusplus
115}
116#endif
117
#define PCF857X_PARAMS
Default configuration parameter set.
#define PCF857X_SAUL_GPIO_PARAMS
Example for mapping expander pins to SAUL.
static const pcf857x_params_t pcf857x_params[]
Allocate some memory to store the actual configuration.
static const pcf857x_saul_gpio_params_t pcf857x_saul_gpio_params[]
Additional meta information to keep in the SAUL registry.
Parameter definitions for mapping peripherals directly to SAUL.
SAUL registry interface definition.
PCF857X device initialization parameters.
Definition pcf857x.h:355
PCF857X configuration structure for mapping expander pins to SAUL.
Definition pcf857x.h:428