Loading...
Searching...
No Matches
mcp47xx_params.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021 Gunar Schorcht
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
15
16#include "board.h"
17#include "mcp47xx.h"
18#include "saul_reg.h"
19#include "saul/periph.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
29#ifndef MCP47XX_PARAM_VARIANT
31#define MCP47XX_PARAM_VARIANT (MCP4725)
32#endif
33
34#ifndef MCP47XX_PARAM_DEV
36#define MCP47XX_PARAM_DEV I2C_DEV(0)
37#endif
38
39#ifndef MCP47XX_PARAM_ADDR
41#define MCP47XX_PARAM_ADDR (MCP47XX_BASE_ADDR + 2)
42#endif
43
44#ifndef MCP47XX_PARAM_GAIN
46#define MCP47XX_PARAM_GAIN (MCP47XX_GAIN_1X)
47#endif
48
49#ifndef MCP47XX_PARAM_VREF
51#define MCP47XX_PARAM_VREF (MCP47XX_VREF_VDD)
52#endif
53
54#ifndef MCP47XX_PARAM_PD_MODE
56#define MCP47XX_PARAM_PD_MODE (MCP47XX_PD_LARGE)
57#endif
58
59#ifndef MCP47XX_PARAMS
61#define MCP47XX_PARAMS { \
62 .dev = MCP47XX_PARAM_DEV, \
63 .addr = MCP47XX_PARAM_ADDR, \
64 .variant = MCP47XX_PARAM_VARIANT, \
65 .gain = MCP47XX_PARAM_GAIN, \
66 .vref = MCP47XX_PARAM_VREF, \
67 .pd_mode = MCP47XX_PARAM_PD_MODE, \
68 },
69#endif /* MCP47XX_PARAMS */
70
71#ifndef MCP47XX_SAUL_DAC_PARAMS
73#define MCP47XX_SAUL_DAC_PARAMS { \
74 .name = "DAC00", \
75 .dev = 0, \
76 .channel = 0, \
77 .initial = 32768, \
78 },
79#endif
81
86{
88};
89
90#if IS_USED(MODULE_SAUL) || DOXYGEN
98#endif /* IS_USED(MODULE_SAUL) || DOXYGEN */
99
100#ifdef __cplusplus
101}
102#endif
103
static const mcp47xx_params_t mcp47xx_params[]
Allocate some memory to store the actual configuration.
#define MCP47XX_PARAMS
Default MCP47xx configuration parameters.
#define MCP47XX_SAUL_DAC_PARAMS
Example for mapping DAC channels to SAUL.
static const mcp47xx_saul_dac_params_t mcp47xx_saul_dac_params[]
Additional meta information to keep in the SAUL registry.
Parameter definitions for mapping peripherals directly to SAUL.
SAUL registry interface definition.
MCP47xx device configuration parameters.
Definition mcp47xx.h:209
MCP47xx configuration structure for mapping DAC channels to SAUL.
Definition mcp47xx.h:235