Loading...
Searching...
No Matches
mcp47xx_params.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 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 "mcp47xx.h"
21#include "saul_reg.h"
22#include "saul/periph.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
32#ifndef MCP47XX_PARAM_VARIANT
34#define MCP47XX_PARAM_VARIANT (MCP4725)
35#endif
36
37#ifndef MCP47XX_PARAM_DEV
39#define MCP47XX_PARAM_DEV I2C_DEV(0)
40#endif
41
42#ifndef MCP47XX_PARAM_ADDR
44#define MCP47XX_PARAM_ADDR (MCP47XX_BASE_ADDR + 2)
45#endif
46
47#ifndef MCP47XX_PARAM_GAIN
49#define MCP47XX_PARAM_GAIN (MCP47XX_GAIN_1X)
50#endif
51
52#ifndef MCP47XX_PARAM_VREF
54#define MCP47XX_PARAM_VREF (MCP47XX_VREF_VDD)
55#endif
56
57#ifndef MCP47XX_PARAM_PD_MODE
59#define MCP47XX_PARAM_PD_MODE (MCP47XX_PD_LARGE)
60#endif
61
62#ifndef MCP47XX_PARAMS
64#define MCP47XX_PARAMS { \
65 .dev = MCP47XX_PARAM_DEV, \
66 .addr = MCP47XX_PARAM_ADDR, \
67 .variant = MCP47XX_PARAM_VARIANT, \
68 .gain = MCP47XX_PARAM_GAIN, \
69 .vref = MCP47XX_PARAM_VREF, \
70 .pd_mode = MCP47XX_PARAM_PD_MODE, \
71 },
72#endif /* MCP47XX_PARAMS */
73
74#ifndef MCP47XX_SAUL_DAC_PARAMS
76#define MCP47XX_SAUL_DAC_PARAMS { \
77 .name = "DAC00", \
78 .dev = 0, \
79 .channel = 0, \
80 .initial = 32768, \
81 },
82#endif
84
89{
91};
92
93#if IS_USED(MODULE_SAUL) || DOXYGEN
101#endif /* IS_USED(MODULE_SAUL) || DOXYGEN */
102
103#ifdef __cplusplus
104}
105#endif
106
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:212
MCP47xx configuration structure for mapping DAC channels to SAUL.
Definition mcp47xx.h:238