Loading...
Searching...
No Matches
ina3221_params.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019 Otto-von-Guericke-Universität Magdeburg
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
22
23#include "board.h"
24#include "ina3221.h"
25#include "saul_reg.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#ifndef INA3221_PARAM_I2C
32#define INA3221_PARAM_I2C (I2C_DEV(0))
33#endif
34
35#ifndef INA3221_PARAM_ADDR
36#define INA3221_PARAM_ADDR (INA3221_ADDR_00)
37#endif
38
39#ifndef INA3221_PARAM_PIN_WRN
40#define INA3221_PARAM_PIN_WRN (GPIO_UNDEF)
41#endif
42
43#ifndef INA3221_PARAM_PIN_CRT
44#define INA3221_PARAM_PIN_CRT (GPIO_UNDEF)
45#endif
46
47#ifndef INA3221_PARAM_PIN_PV
48#define INA3221_PARAM_PIN_PV (GPIO_UNDEF)
49#endif
50
51#ifndef INA3221_PARAM_PIN_TC
52#define INA3221_PARAM_PIN_TC (GPIO_UNDEF)
53#endif
54
55#ifndef INA3221_PARAM_INT_PU_PIN_WRN
56#define INA3221_PARAM_INT_PU_PIN_WRN (0)
57#endif
58
59#ifndef INA3221_PARAM_INT_PU_PIN_CRT
60#define INA3221_PARAM_INT_PU_PIN_CRT (0)
61#endif
62
63#ifndef INA3221_PARAM_INT_PU_PIN_PV
64#define INA3221_PARAM_INT_PU_PIN_PV (0)
65#endif
66
67#ifndef INA3221_PARAM_INT_PU_PIN_TC
68#define INA3221_PARAM_INT_PU_PIN_TC (0)
69#endif
70
71#ifndef INA3221_PARAM_CONFIG
72#define INA3221_PARAM_CONFIG ( \
73 INA3221_ENABLE_CH1 | \
74 INA3221_ENABLE_CH2 | \
75 INA3221_ENABLE_CH3 | \
76 INA3221_NUM_SAMPLES_4 | \
77 INA3221_CONV_TIME_BADC_4156US | \
78 INA3221_CONV_TIME_SADC_4156US | \
79 INA3221_MODE_CONTINUOUS_SHUNT_BUS \
80 )
81#endif
82
83#ifndef INA3221_PARAM_RSHUNT_MOHM_CH1
84#define INA3221_PARAM_RSHUNT_MOHM_CH1 (100)
85#endif
86
87#ifndef INA3221_PARAM_RSHUNT_MOHM_CH2
88#define INA3221_PARAM_RSHUNT_MOHM_CH2 (100)
89#endif
90
91#ifndef INA3221_PARAM_RSHUNT_MOHM_CH3
92#define INA3221_PARAM_RSHUNT_MOHM_CH3 (100)
93#endif
94
95#ifndef INA3221_PARAMS
96#define INA3221_PARAMS { \
97 .i2c = INA3221_PARAM_I2C, \
98 .addr = INA3221_PARAM_ADDR, \
99 .upins.pins = { \
100 .pin_warn = INA3221_PARAM_PIN_WRN, \
101 .pin_crit = INA3221_PARAM_PIN_CRT, \
102 .pin_tc = INA3221_PARAM_PIN_TC, \
103 .pin_pv = INA3221_PARAM_PIN_PV \
104 }, \
105 .gpio_config = (INA3221_PARAM_INT_PU_PIN_WRN << INA3221_ALERT_WRN) | \
106 (INA3221_PARAM_INT_PU_PIN_CRT << INA3221_ALERT_CRT) | \
107 (INA3221_PARAM_INT_PU_PIN_TC << INA3221_ALERT_TC) | \
108 (INA3221_PARAM_INT_PU_PIN_PV << INA3221_ALERT_PV), \
109 .config = INA3221_PARAM_CONFIG, \
110 .rshunt_mohm = { \
111 INA3221_PARAM_RSHUNT_MOHM_CH1, \
112 INA3221_PARAM_RSHUNT_MOHM_CH2, \
113 INA3221_PARAM_RSHUNT_MOHM_CH3 \
114 } \
115}
116#endif
117
118#ifndef INA3221_SAUL_INFO
119#define INA3221_SAUL_INFO { .name = "INA3221 bus voltage" }, \
120 { .name = "INA3221 current" }, \
121 { .name = "INA3221 power" }, \
122 { .name = "INA3221 shunt voltage sum" }
123#endif
124
130};
131
138#ifdef __cplusplus
139}
140#endif
141
Device driver interface for Texas Instruments INA3221 three-channel, high-side current and bus voltag...
static const ina3221_params_t ina3221_params[]
INA3221 array of device configurations.
#define INA3221_SAUL_INFO
SAUL driver information.
static const saul_reg_info_t ina3221_saul_info[]
INA3221 array of SAUL driver information.
#define INA3221_PARAMS
Default device initialization parameters.
SAUL registry interface definition.
INA3221 device parameters.
Definition ina3221.h:252
Additional data to collect for each entry.
Definition saul_reg.h:48