Loading...
Searching...
No Matches
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
9#pragma once
10
18
19#include "board.h"
20#include "pcf857x.h"
21#include "saul_reg.h"
22#include "saul/periph.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
32#ifndef PCF857X_PARAM_DEV
34#define PCF857X_PARAM_DEV I2C_DEV(0)
35#endif
36
37#ifndef PCF857X_PARAM_ADDR
39#define PCF857X_PARAM_ADDR (0)
40#endif
41
42#ifndef PCF857X_PARAM_EXP
44#if IS_USED(MODULE_PCF8575) || DOXYGEN
45#define PCF857X_PARAM_EXP (PCF857X_EXP_PCF8575)
46#elif IS_USED(MODULE_PCF8574)
47#define PCF857X_PARAM_EXP (PCF857X_EXP_PCF8574)
48#elif IS_USED(MODULE_PCF8574A)
49#define PCF857X_PARAM_EXP (PCF857X_EXP_PCF8574A)
50#endif
51#endif /* PCF857X_PARAM_EXP */
52
53#ifndef PCF857X_PARAM_INT_PIN
55#define PCF857X_PARAM_INT_PIN (GPIO_UNDEF)
56#endif
57
58#ifndef PCF857X_PARAMS
59#if IS_USED(MODULE_PCF857X_IRQ) || DOXYGEN
61#define PCF857X_PARAMS { \
62 .dev = PCF857X_PARAM_DEV, \
63 .addr = PCF857X_PARAM_ADDR, \
64 .exp = PCF857X_PARAM_EXP, \
65 .int_pin = PCF857X_PARAM_INT_PIN, \
66 },
67#else
68#define PCF857X_PARAMS { \
69 .dev = PCF857X_PARAM_DEV, \
70 .addr = PCF857X_PARAM_ADDR, \
71 .exp = PCF857X_PARAM_EXP, \
72 },
73#endif
74#endif /* PCF857X_PARAMS */
75
76#ifndef PCF857X_SAUL_GPIO_PARAMS
78#define PCF857X_SAUL_GPIO_PARAMS { \
79 .dev = 0, \
80 .gpio = { \
81 .name = "P00 Output", \
82 .pin = PCF857X_GPIO_PIN(0, 0), \
83 .mode = GPIO_OUT, \
84 .flags = SAUL_GPIO_INIT_CLEAR, \
85 } \
86 }, \
87 { \
88 .dev = 0, \
89 .gpio = { \
90 .name = "P01 Input", \
91 .pin = PCF857X_GPIO_PIN(0, 1), \
92 .mode = GPIO_IN, \
93 .flags = 0, \
94 } \
95 },
96#endif
98
103{
105};
106
107#if IS_USED(MODULE_SAUL_GPIO) || DOXYGEN
115#endif /* MODULE_SAUL_GPIO || DOXYGEN */
116
117#ifdef __cplusplus
118}
119#endif
120
#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:369
PCF857X configuration structure for mapping expander pins to SAUL.
Definition pcf857x.h:442