ina2xx_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 
19 #ifndef INA2XX_PARAMS_H
20 #define INA2XX_PARAMS_H
21 
22 #include "board.h"
23 #include "ina2xx.h"
24 #include "saul_reg.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
34 #ifndef INA2XX_PARAM_I2C
35 
38 #define INA2XX_PARAM_I2C (I2C_DEV(0))
39 #endif
40 #ifndef INA2XX_PARAM_ADDR
41 
48 #define INA2XX_PARAM_ADDR (0x40)
49 #endif
50 #ifndef INA2XX_PARAM_CONFIG
51 
64 #define INA2XX_PARAM_CONFIG (INA2XX_MODE_CONTINUOUS_SHUNT_BUS | \
65  INA2XX_SADC_AVG_128_SAMPLES | \
66  INA2XX_BADC_AVG_128_SAMPLES | \
67  INA2XX_SHUNT_RANGE_80MV | \
68  INA2XX_BUS_RANGE_16V)
69 #endif
70 #ifndef INA2XX_PARAM_RSHUNT_MOHM
71 
76 #define INA2XX_PARAM_RSHUNT_MOHM (100)
77 #endif
78 #ifndef INA2XX_PARAM_I_RANGE
79 
85 #define INA2XX_PARAM_I_RANGE (INA2XX_CURRENT_RANGE_655_MA)
86 #endif
87 #ifndef INA2XX_PARAMS
88 #define INA2XX_PARAMS { .i2c = INA2XX_PARAM_I2C, \
89  .addr = INA2XX_PARAM_ADDR, \
90  .config = INA2XX_PARAM_CONFIG, \
91  .rshunt_mohm = INA2XX_PARAM_RSHUNT_MOHM, \
92  .i_range = INA2XX_PARAM_I_RANGE }
93 #endif
94 
100 #ifndef INA2XX_SAULINFO
101 #define INA2XX_SAULINFO { .name = "INA2XX current" }, \
102  { .name = "INA2XX power" }, \
103  { .name = "INA2XX voltage" }
104 #endif
105 
111 {
112  INA2XX_PARAMS
113 };
114 
119 {
120  INA2XX_SAULINFO
121 };
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif /* INA2XX_PARAMS_H */
128 
saul_reg_info_t
Additional data to collect for each entry.
Definition: saul_reg.h:49
ina2xx_params
static const ina2xx_params_t ina2xx_params[]
Configure INA2XX devices.
Definition: ina2xx_params.h:110
saul_reg.h
SAUL registry interface definition.
ina2xx.h
Device driver interface for Texas Instruments INA219/INA2XX Bi-Directional CURRENT/POWER MONITOR with...
ina2xx_saul_info
static const saul_reg_info_t ina2xx_saul_info[]
Allocate and configure entries to the SAUL registry.
Definition: ina2xx_params.h:118
ina2xx_params_t
Configuration parameters of the INA2xx driver.
Definition: ina2xx.h:176