pcf857x_params.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Gunar Schorcht
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
17 #ifndef PCF857X_PARAMS_H
18 #define PCF857X_PARAMS_H
19 
20 #include "board.h"
21 #include "pcf857x.h"
22 #include "saul_reg.h"
23 #include "saul/periph.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
33 #ifndef PCF857X_PARAM_DEV
35 #define PCF857X_PARAM_DEV I2C_DEV(0)
36 #endif
37 
38 #ifndef PCF857X_PARAM_ADDR
40 #define PCF857X_PARAM_ADDR (0)
41 #endif
42 
43 #ifndef PCF857X_PARAM_EXP
45 #if IS_USED(MODULE_PCF8575) || DOXYGEN
46 #define PCF857X_PARAM_EXP (PCF857X_EXP_PCF8575)
47 #elif IS_USED(MODULE_PCF8574)
48 #define PCF857X_PARAM_EXP (PCF857X_EXP_PCF8574)
49 #elif IS_USED(MODULE_PCF8574A)
50 #define PCF857X_PARAM_EXP (PCF857X_EXP_PCF8574A)
51 #endif
52 #endif /* PCF857X_PARAM_EXP */
53 
54 #ifndef PCF857X_PARAM_INT_PIN
56 #define PCF857X_PARAM_INT_PIN (GPIO_UNDEF)
57 #endif
58 
59 #ifndef PCF857X_PARAMS
60 #if IS_USED(MODULE_PCF857X_IRQ) || DOXYGEN
62 #define PCF857X_PARAMS { \
63  .dev = PCF857X_PARAM_DEV, \
64  .addr = PCF857X_PARAM_ADDR, \
65  .exp = PCF857X_PARAM_EXP, \
66  .int_pin = PCF857X_PARAM_INT_PIN, \
67  },
68 #else
69 #define PCF857X_PARAMS { \
70  .dev = PCF857X_PARAM_DEV, \
71  .addr = PCF857X_PARAM_ADDR, \
72  .exp = PCF857X_PARAM_EXP, \
73  },
74 #endif
75 #endif /* PCF857X_PARAMS */
76 
77 #ifndef PCF857X_SAUL_GPIO_PARAMS
79 #define PCF857X_SAUL_GPIO_PARAMS { \
80  .dev = 0, \
81  .gpio = { \
82  .name = "P00 Output", \
83  .pin = PCF857X_GPIO_PIN(0, 0), \
84  .mode = GPIO_OUT, \
85  .flags = SAUL_GPIO_INIT_CLEAR, \
86  } \
87  }, \
88  { \
89  .dev = 0, \
90  .gpio = { \
91  .name = "P01 Input", \
92  .pin = PCF857X_GPIO_PIN(0, 1), \
93  .mode = GPIO_IN, \
94  .flags = 0, \
95  } \
96  },
97 #endif
104 {
106 };
107 
108 #if IS_USED(MODULE_SAUL_GPIO) || DOXYGEN
113 {
115 };
116 #endif /* MODULE_SAUL_GPIO || DOXYGEN */
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* PCF857X_PARAMS_H */
#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:370
PCF857X configuration structure for mapping expander pins to SAUL.
Definition: pcf857x.h:443