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