vcpmonitor3  2.0.0.0
vcpmonitor3.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2020 MikroElektronika d.o.o.
3 ** Contact: https://www.mikroe.com/contact
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a copy
6 ** of this software and associated documentation files (the "Software"), to deal
7 ** in the Software without restriction, including without limitation the rights
8 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 ** copies of the Software, and to permit persons to whom the Software is
10 ** furnished to do so, subject to the following conditions:
11 ** The above copyright notice and this permission notice shall be
12 ** included in all copies or substantial portions of the Software.
13 **
14 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 ** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 ** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19 ** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 ** USE OR OTHER DEALINGS IN THE SOFTWARE.
21 ****************************************************************************/
22 
28 #ifndef VCPMONITOR3_H
29 #define VCPMONITOR3_H
30 
31 #ifdef __cplusplus
32 extern "C"{
33 #endif
34 
39 #ifdef PREINIT_SUPPORTED
40 #include "preinit.h"
41 #endif
42 
43 #ifdef MikroCCoreVersion
44  #if MikroCCoreVersion >= 1
45  #include "delays.h"
46  #endif
47 #endif
48 
49 #include "drv_digital_out.h"
50 #include "drv_digital_in.h"
51 #include "drv_i2c_master.h"
52 #include "drv_spi_master.h"
53 #include "spi_specifics.h"
54 
75 #define VCPMONITOR3_REG_GPIOSTATCL 0x67
76 #define VCPMONITOR3_REG_STATUS 0x80
77 #define VCPMONITOR3_REG_STATVT 0x81
78 #define VCPMONITOR3_REG_STATIP 0x82
79 #define VCPMONITOR3_REG_STATC 0x83
80 #define VCPMONITOR3_REG_STATE 0x84
81 #define VCPMONITOR3_REG_STATCEOF 0x85
82 #define VCPMONITOR3_REG_STATTB 0x86
83 #define VCPMONITOR3_REG_STATVDVCC 0x87
84 #define VCPMONITOR3_REG_STATUSM 0x88
85 #define VCPMONITOR3_REG_STATVTM 0x89
86 #define VCPMONITOR3_REG_STATIPM 0x8A
87 #define VCPMONITOR3_REG_STATCM 0x8B
88 #define VCPMONITOR3_REG_STATEM 0x8C
89 #define VCPMONITOR3_REG_STATCEOFM 0x8D
90 #define VCPMONITOR3_REG_STATTBM 0x8E
91 #define VCPMONITOR3_REG_STATVDVCCM 0x8F
92 #define VCPMONITOR3_REG_ACCICTL 0xE1
93 #define VCPMONITOR3_REG_ACCGPCTL 0xE3
94 #define VCPMONITOR3_REG_ACCIDB 0xE4
95 #define VCPMONITOR3_REG_ALERTBCTL 0xE8
96 #define VCPMONITOR3_REG_TBCTL 0xE9
97 #define VCPMONITOR3_REG_OPCTL 0xF0
98 #define VCPMONITOR3_REG_PGCTL 0xFF
99 
104 #define VCPMONITOR3_REG_C1_47_40 0x00
105 #define VCPMONITOR3_REG_C1_39_32 0x01
106 #define VCPMONITOR3_REG_C1_31_24 0x02
107 #define VCPMONITOR3_REG_C1_23_16 0x03
108 #define VCPMONITOR3_REG_C1_15_8 0x04
109 #define VCPMONITOR3_REG_C1_7_0 0x05
110 #define VCPMONITOR3_REG_E1_47_40 0x06
111 #define VCPMONITOR3_REG_E1_39_32 0x07
112 #define VCPMONITOR3_REG_E1_31_24 0x08
113 #define VCPMONITOR3_REG_E1_23_16 0x09
114 #define VCPMONITOR3_REG_E1_15_8 0x0A
115 #define VCPMONITOR3_REG_E1_7_0 0x0B
116 #define VCPMONITOR3_REG_TB1_31_24 0x0C
117 #define VCPMONITOR3_REG_TB1_23_16 0x0D
118 #define VCPMONITOR3_REG_TB1_15_8 0x0E
119 #define VCPMONITOR3_REG_TB1_7_0 0x0F
120 #define VCPMONITOR3_REG_C2_47_40 0x10
121 #define VCPMONITOR3_REG_C2_39_32 0x11
122 #define VCPMONITOR3_REG_C2_31_24 0x12
123 #define VCPMONITOR3_REG_C2_23_16 0x13
124 #define VCPMONITOR3_REG_C2_15_8 0x14
125 #define VCPMONITOR3_REG_C2_7_0 0x15
126 #define VCPMONITOR3_REG_E2_47_40 0x16
127 #define VCPMONITOR3_REG_E2_39_32 0x17
128 #define VCPMONITOR3_REG_E2_31_24 0x18
129 #define VCPMONITOR3_REG_E2_23_16 0x19
130 #define VCPMONITOR3_REG_E2_15_8 0x1A
131 #define VCPMONITOR3_REG_E2_7_0 0x1B
132 #define VCPMONITOR3_REG_TB2_31_24 0x1C
133 #define VCPMONITOR3_REG_TB2_23_16 0x1D
134 #define VCPMONITOR3_REG_TB2_15_8 0x1E
135 #define VCPMONITOR3_REG_TB2_7_0 0x1F
136 #define VCPMONITOR3_REG_IMAX_15_8 0x40
137 #define VCPMONITOR3_REG_IMAX_7_0 0x41
138 #define VCPMONITOR3_REG_IMIN_15_8 0x42
139 #define VCPMONITOR3_REG_IMIN_7_0 0x43
140 #define VCPMONITOR3_REG_PMAX_15_8 0x44
141 #define VCPMONITOR3_REG_PMAX_7_0 0x45
142 #define VCPMONITOR3_REG_PMIN_15_8 0x46
143 #define VCPMONITOR3_REG_PMIN_7_0 0x47
144 #define VCPMONITOR3_REG_VMAX_15_8 0x50
145 #define VCPMONITOR3_REG_VMAX_7_0 0x51
146 #define VCPMONITOR3_REG_VMIN_15_8 0x52
147 #define VCPMONITOR3_REG_VMIN_7_0 0x53
148 #define VCPMONITOR3_REG_TEMPMAX_15_8 0x54
149 #define VCPMONITOR3_REG_TEMPMAX_7_0 0x55
150 #define VCPMONITOR3_REG_TEMPMIN_15_8 0x56
151 #define VCPMONITOR3_REG_TEMPMIN_7_0 0x57
152 #define VCPMONITOR3_REG_VDVCCMAX_15_8 0x58
153 #define VCPMONITOR3_REG_VDVCCMAX_7_0 0x59
154 #define VCPMONITOR3_REG_VDVCCMIN_15_8 0x5A
155 #define VCPMONITOR3_REG_VDVCCMIN_7_0 0x5B
156 #define VCPMONITOR3_REG_I_23_16 0x90
157 #define VCPMONITOR3_REG_I_15_8 0x91
158 #define VCPMONITOR3_REG_I_7_0 0x92
159 #define VCPMONITOR3_REG_P_23_16 0x93
160 #define VCPMONITOR3_REG_P_15_8 0x94
161 #define VCPMONITOR3_REG_P_7_0 0x95
162 #define VCPMONITOR3_REG_V_15_8 0xA0
163 #define VCPMONITOR3_REG_V_7_0 0xA1
164 #define VCPMONITOR3_REG_TEMP_15_8 0xA2
165 #define VCPMONITOR3_REG_TEMP_7_0 0xA3
166 #define VCPMONITOR3_REG_VDVCC_15_8 0xA4
167 #define VCPMONITOR3_REG_VDVCC_7_0 0xA5
168 #define VCPMONITOR3_REG_IH1_23_16 0xB0
169 #define VCPMONITOR3_REG_IH1_15_8 0xB1
170 #define VCPMONITOR3_REG_IH1_7_0 0xB2
171 #define VCPMONITOR3_REG_IH2_23_16 0xB3
172 #define VCPMONITOR3_REG_IH2_15_8 0xB4
173 #define VCPMONITOR3_REG_IH2_7_0 0xB5
174 #define VCPMONITOR3_REG_IH3_23_16 0xB6
175 #define VCPMONITOR3_REG_IH3_15_8 0xB7
176 #define VCPMONITOR3_REG_IH3_7_0 0xB8
177 #define VCPMONITOR3_REG_IH4_23_16 0xB9
178 #define VCPMONITOR3_REG_IH4_15_8 0xBA
179 #define VCPMONITOR3_REG_IH4_7_0 0xBB
180 #define VCPMONITOR3_REG_IH5_23_16 0xBC
181 #define VCPMONITOR3_REG_IH5_15_8 0xBD
182 #define VCPMONITOR3_REG_IH5_7_0 0xBE
183 
188 #define VCPMONITOR3_REG_C1TH_47_40 0x00
189 #define VCPMONITOR3_REG_C1TH_39_32 0x01
190 #define VCPMONITOR3_REG_C1TH_31_24 0x02
191 #define VCPMONITOR3_REG_C1TH_23_16 0x03
192 #define VCPMONITOR3_REG_C1TH_15_8 0x04
193 #define VCPMONITOR3_REG_C1TH_7_0 0x05
194 #define VCPMONITOR3_REG_C1TL_47_40 0x06
195 #define VCPMONITOR3_REG_C1TL_39_32 0x07
196 #define VCPMONITOR3_REG_C1TL_31_24 0x08
197 #define VCPMONITOR3_REG_C1TL_23_16 0x09
198 #define VCPMONITOR3_REG_C1TL_15_8 0x0A
199 #define VCPMONITOR3_REG_C1TL_7_0 0x0B
200 #define VCPMONITOR3_REG_TB1TH_31_24 0x0C
201 #define VCPMONITOR3_REG_TB1TH_23_16 0x0D
202 #define VCPMONITOR3_REG_TB1TH_15_8 0x0E
203 #define VCPMONITOR3_REG_TB1TH_7_0 0x0F
204 #define VCPMONITOR3_REG_E1TH_47_40 0x10
205 #define VCPMONITOR3_REG_E1TH_39_32 0x11
206 #define VCPMONITOR3_REG_E1TH_31_24 0x12
207 #define VCPMONITOR3_REG_E1TH_23_16 0x13
208 #define VCPMONITOR3_REG_E1TH_15_8 0x14
209 #define VCPMONITOR3_REG_E1TH_7_0 0x15
210 #define VCPMONITOR3_REG_E1TL_47_40 0x16
211 #define VCPMONITOR3_REG_E1TL_39_32 0x17
212 #define VCPMONITOR3_REG_E1TL_31_24 0x18
213 #define VCPMONITOR3_REG_E1TL_23_16 0x19
214 #define VCPMONITOR3_REG_E1TL_15_8 0x1A
215 #define VCPMONITOR3_REG_E1TL_7_0 0x1B
216 #define VCPMONITOR3_REG_C2TH_47_40 0x20
217 #define VCPMONITOR3_REG_C2TH_39_32 0x21
218 #define VCPMONITOR3_REG_C2TH_31_24 0x22
219 #define VCPMONITOR3_REG_C2TH_23_16 0x23
220 #define VCPMONITOR3_REG_C2TH_15_8 0x24
221 #define VCPMONITOR3_REG_C2TH_7_0 0x25
222 #define VCPMONITOR3_REG_C2TL_47_40 0x26
223 #define VCPMONITOR3_REG_C2TL_39_32 0x27
224 #define VCPMONITOR3_REG_C2TL_31_24 0x28
225 #define VCPMONITOR3_REG_C2TL_23_16 0x29
226 #define VCPMONITOR3_REG_C2TL_15_8 0x2A
227 #define VCPMONITOR3_REG_C2TL_7_0 0x2B
228 #define VCPMONITOR3_REG_TB2TH_31_24 0x2C
229 #define VCPMONITOR3_REG_TB2TH_23_16 0x2D
230 #define VCPMONITOR3_REG_TB2TH_15_8 0x2E
231 #define VCPMONITOR3_REG_TB2TH_7_0 0x2F
232 #define VCPMONITOR3_REG_E2TH_47_40 0x30
233 #define VCPMONITOR3_REG_E2TH_39_32 0x31
234 #define VCPMONITOR3_REG_E2TH_31_24 0x32
235 #define VCPMONITOR3_REG_E2TH_23_16 0x33
236 #define VCPMONITOR3_REG_E2TH_15_8 0x34
237 #define VCPMONITOR3_REG_E2TH_7_0 0x35
238 #define VCPMONITOR3_REG_E2TL_47_40 0x36
239 #define VCPMONITOR3_REG_E2TL_39_32 0x37
240 #define VCPMONITOR3_REG_E2TL_31_24 0x38
241 #define VCPMONITOR3_REG_E2TL_23_16 0x39
242 #define VCPMONITOR3_REG_E2TL_15_8 0x3A
243 #define VCPMONITOR3_REG_E2TL_7_0 0x3B
244 #define VCPMONITOR3_REG_ITH_15_8 0x80
245 #define VCPMONITOR3_REG_ITH_7_0 0x81
246 #define VCPMONITOR3_REG_ITL_15_8 0x82
247 #define VCPMONITOR3_REG_ITL_7_0 0x83
248 #define VCPMONITOR3_REG_PTH_15_8 0x84
249 #define VCPMONITOR3_REG_PTH_7_0 0x85
250 #define VCPMONITOR3_REG_PTL_15_8 0x86
251 #define VCPMONITOR3_REG_PTL_7_0 0x87
252 #define VCPMONITOR3_REG_VTH_15_8 0x90
253 #define VCPMONITOR3_REG_VTH_7_0 0x91
254 #define VCPMONITOR3_REG_VTL_15_8 0x92
255 #define VCPMONITOR3_REG_VTL_7_0 0x93
256 #define VCPMONITOR3_REG_TEMPTH_15_8 0x94
257 #define VCPMONITOR3_REG_TEMPTH_7_0 0x95
258 #define VCPMONITOR3_REG_TEMPTL_15_8 0x96
259 #define VCPMONITOR3_REG_TEMPTL_7_0 0x97
260 #define VCPMONITOR3_REG_VDVCCTH_15_8 0x98
261 #define VCPMONITOR3_REG_VDVCCTH_7_0 0x99
262 #define VCPMONITOR3_REG_VDVCCTL_15_8 0x9A
263 #define VCPMONITOR3_REG_VDVCCTL_7_0 0x9B
264 #define VCPMONITOR3_REG_TEMPTFANH_15_8 0x9C
265 #define VCPMONITOR3_REG_TEMPTFANH_7_0 0x9D
266 #define VCPMONITOR3_REG_TEMPTFANL_15_8 0x9E
267 #define VCPMONITOR3_REG_TEMPTFANL_7_0 0x9F
268  // vcpmonitor3_reg
270 
289 #define VCPMONITOR3_VAL_C1 0x00
290 #define VCPMONITOR3_VAL_E1 0x06
291 #define VCPMONITOR3_VAL_TB1 0x0C
292 #define VCPMONITOR3_VAL_C2 0x10
293 #define VCPMONITOR3_VAL_E2 0x16
294 #define VCPMONITOR3_VAL_TB2 0x1C
295 #define VCPMONITOR3_VAL_IMAX 0x40
296 #define VCPMONITOR3_VAL_IMIN 0x42
297 #define VCPMONITOR3_VAL_PMAX 0x44
298 #define VCPMONITOR3_VAL_PMIN 0x46
299 #define VCPMONITOR3_VAL_VMAX 0x50
300 #define VCPMONITOR3_VAL_VMIN 0x52
301 #define VCPMONITOR3_VAL_TEMPMAX 0x54
302 #define VCPMONITOR3_VAL_TEMPMIN 0x56
303 #define VCPMONITOR3_VAL_VDVCCMAX 0x58
304 #define VCPMONITOR3_VAL_VDVCCMIN 0x5A
305 #define VCPMONITOR3_VAL_I 0x90
306 #define VCPMONITOR3_VAL_P 0x93
307 #define VCPMONITOR3_VAL_V 0xA0
308 #define VCPMONITOR3_VAL_TEMP 0xA2
309 #define VCPMONITOR3_VAL_VDVCC 0xA4
310 #define VCPMONITOR3_VAL_IH1 0xB0
311 #define VCPMONITOR3_VAL_IH2 0xB3
312 #define VCPMONITOR3_VAL_IH3 0xB6
313 #define VCPMONITOR3_VAL_IH4 0xB9
314 #define VCPMONITOR3_VAL_IH5 0xBC
315 
321 #define VCPMONITOR3_VAL_C1TH 0x00
322 #define VCPMONITOR3_VAL_C1TL 0x06
323 #define VCPMONITOR3_VAL_TB1TH 0x0C
324 #define VCPMONITOR3_VAL_E1TH 0x10
325 #define VCPMONITOR3_VAL_E1TL 0x16
326 #define VCPMONITOR3_VAL_C2TH 0x20
327 #define VCPMONITOR3_VAL_C2TL 0x26
328 #define VCPMONITOR3_VAL_TB2TH 0x2C
329 #define VCPMONITOR3_VAL_E2TH 0x30
330 #define VCPMONITOR3_VAL_E2TL 0x36
331 #define VCPMONITOR3_VAL_ITH 0x80
332 #define VCPMONITOR3_VAL_ITL 0x82
333 #define VCPMONITOR3_VAL_PTH 0x84
334 #define VCPMONITOR3_VAL_PTL 0x86
335 #define VCPMONITOR3_VAL_VTH 0x90
336 #define VCPMONITOR3_VAL_VTL 0x92
337 #define VCPMONITOR3_VAL_TEMPTH 0x94
338 #define VCPMONITOR3_VAL_TEMPTL 0x96
339 #define VCPMONITOR3_VAL_VDVCCTH 0x98
340 #define VCPMONITOR3_VAL_VDVCCTL 0x9A
341 #define VCPMONITOR3_VAL_TEMPTFANH 0x9C
342 #define VCPMONITOR3_VAL_TEMPTFANL 0x9E
343 
348 #define VCPMONITOR3_LSB_IMAX 12.0
349 #define VCPMONITOR3_LSB_IMIN 12.0
350 #define VCPMONITOR3_LSB_PMAX 200.0
351 #define VCPMONITOR3_LSB_PMIN 200.0
352 #define VCPMONITOR3_LSB_VMAX 2.0
353 #define VCPMONITOR3_LSB_VMIN 2.0
354 #define VCPMONITOR3_LSB_TEMPMAX 0.204
355 #define VCPMONITOR3_OFFS_TEMPMAX 5.5
356 #define VCPMONITOR3_LSB_TEMPMIN 0.204
357 #define VCPMONITOR3_OFFS_TEMPMIN 5.5
358 #define VCPMONITOR3_LSB_VDVCCMAX 145.0
359 #define VCPMONITOR3_LSB_VDVCCMIN 145.0
360 #define VCPMONITOR3_LSB_I 3.0
361 #define VCPMONITOR3_LSB_P 50.0
362 #define VCPMONITOR3_LSB_V 2.0
363 #define VCPMONITOR3_LSB_TEMP 0.204
364 #define VCPMONITOR3_OFFS_TEMP 5.5
365 #define VCPMONITOR3_LSB_VDVCC 145.0
366 #define VCPMONITOR3_LSB_IH1 3.0
367 #define VCPMONITOR3_LSB_IH2 3.0
368 #define VCPMONITOR3_LSB_IH3 3.0
369 #define VCPMONITOR3_LSB_IH4 3.0
370 #define VCPMONITOR3_LSB_IH5 3.0
371 #define VCPMONITOR3_LSB_C1 0.0000011933326
372 #define VCPMONITOR3_LSB_E1 0.000019888856
373 #define VCPMONITOR3_LSB_TB1 0.0003977765
374 #define VCPMONITOR3_LSB_C2 0.0000011933326
375 #define VCPMONITOR3_LSB_E2 0.000019888856
376 #define VCPMONITOR3_LSB_TB2 0.0003977765
377 
382 #define VCPMONITOR3_NORM_OP 0x00
383 #define VCPMONITOR3_SHDN 0x01
384 #define VCPMONITOR3_CLR 0x02
385 #define VCPMONITOR3_SSHOT 0x04
386 #define VCPMONITOR3_CONT 0x08
387 #define VCPMONITOR3_RST 0x80
388 
393 #define VCPMONITOR3_UVLOA 0x01
394 #define VCPMONITOR3_PORA 0x02
395 #define VCPMONITOR3_UVLOSTBY 0x04
396 #define VCPMONITOR3_UVLOD 0x08
397 #define VCPMONITOR3_UPDATE 0x10
398 #define VCPMONITOR3_ADCERR 0x20
399 #define VCPMONITOR3_TBERR 0x40
400 
405 #define VCPMONITOR3_SPI_RD_CMD 0x01
406 #define VCPMONITOR3_SPI_WR_CMD 0x00
407 
408 #define VCPMONITOR3_PAGE_0 0x00
409 #define VCPMONITOR3_PAGE_1 0x01
410 
416 #define VCPMONITOR3_I2C_ADR_L_L 0x5C
417 #define VCPMONITOR3_I2C_ADR_L_H 0x5D
418 #define VCPMONITOR3_I2C_ADR_L_R 0x5E
419 #define VCPMONITOR3_I2C_ADR_R_L 0x64
420 #define VCPMONITOR3_I2C_ADR_R_H 0x65
421 #define VCPMONITOR3_I2C_ADR_R_R 0x66
422 
431 #define VCPMONITOR3_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
432 #define VCPMONITOR3_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
433  // vcpmonitor3_set
435 
450 #define VCPMONITOR3_MAP_MIKROBUS( cfg, mikrobus ) \
451  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
452  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
453  cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
454  cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
455  cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
456  cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
457  cfg.gpio = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
458  cfg.alr = MIKROBUS( mikrobus, MIKROBUS_INT )
459  // vcpmonitor3_map // vcpmonitor3
462 
467 typedef enum
468 {
473 
478 typedef err_t ( *vcpmonitor3_master_io_t )( struct vcpmonitor3_s*, uint8_t, uint8_t*, uint8_t );
484 typedef struct vcpmonitor3_s
485 {
486  digital_out_t gpio;
487  digital_in_t alr;
489  i2c_master_t i2c;
490  spi_master_t spi;
492  uint8_t slave_address;
493  pin_name_t chip_select;
500 
505 typedef struct
506 {
507  pin_name_t scl;
508  pin_name_t sda;
509  pin_name_t miso;
510  pin_name_t mosi;
511  pin_name_t sck;
512  pin_name_t cs;
513  pin_name_t gpio;
514  pin_name_t alr;
516  uint32_t i2c_speed;
517  uint8_t i2c_address;
519  uint32_t spi_speed;
520  spi_master_mode_t spi_mode;
521  spi_master_chip_select_polarity_t cs_polarity;
526 
531 typedef enum
532 {
534  VCPMONITOR3_ERROR = -1
535 
537 
554 
570 
586 
601 
617 err_t vcpmonitor3_generic_write ( vcpmonitor3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len );
618 
634 err_t vcpmonitor3_generic_read ( vcpmonitor3_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len );
635 
647 void vcpmonitor3_wr_page_0 ( vcpmonitor3_t *ctx, uint8_t reg, uint8_t *wr_data, uint8_t n_bytes );
648 
660 void vcpmonitor3_rd_page_0 ( vcpmonitor3_t *ctx, uint8_t reg, uint8_t *rd_data, uint8_t n_bytes );
661 
673 void vcpmonitor3_wr_page_1 ( vcpmonitor3_t *ctx, uint8_t reg, uint8_t *wr_data, uint8_t n_bytes );
674 
686 void vcpmonitor3_rd_page_1 ( vcpmonitor3_t *ctx, uint8_t reg, uint8_t *rd_data, uint8_t n_bytes );
687 
696 void vcpmonitor3_set_op_mode ( vcpmonitor3_t *ctx, uint8_t op_mode );
697 
706 
715 
724 
733 
742 
751 float vcpmonitor3_read_c ( vcpmonitor3_t *ctx, uint8_t accu_set1 );
752 
761 float vcpmonitor3_read_e ( vcpmonitor3_t *ctx, uint8_t accu_set1 );
762 
771 float vcpmonitor3_read_tb ( vcpmonitor3_t *ctx, uint8_t accu_set1 );
772 
781 
782 #ifdef __cplusplus
783 }
784 #endif
785 #endif // VCPMONITOR3_H
786  // vcpmonitor3
788 
789 // ------------------------------------------------------------------------ END
vcpmonitor3_cfg_t::sck
pin_name_t sck
Definition: vcpmonitor3.h:511
vcpmonitor3_cfg_t::cs_polarity
spi_master_chip_select_polarity_t cs_polarity
Definition: vcpmonitor3.h:521
vcpmonitor3_return_value_t
vcpmonitor3_return_value_t
VCP Monitor 3 Click return value data.
Definition: vcpmonitor3.h:532
vcpmonitor3_generic_write
err_t vcpmonitor3_generic_write(vcpmonitor3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
VCP Monitor 3 data writing function.
vcpmonitor3_s::spi
spi_master_t spi
Definition: vcpmonitor3.h:490
vcpmonitor3_s::drv_sel
vcpmonitor3_drv_t drv_sel
Definition: vcpmonitor3.h:494
vcpmonitor3_cfg_t::sda
pin_name_t sda
Definition: vcpmonitor3.h:508
VCPMONITOR3_OK
@ VCPMONITOR3_OK
Definition: vcpmonitor3.h:533
vcpmonitor3_drv_t
vcpmonitor3_drv_t
VCP Monitor 3 Click driver selector.
Definition: vcpmonitor3.h:468
VCPMONITOR3_DRV_SEL_I2C
@ VCPMONITOR3_DRV_SEL_I2C
Definition: vcpmonitor3.h:470
VCPMONITOR3_DRV_SEL_SPI
@ VCPMONITOR3_DRV_SEL_SPI
Definition: vcpmonitor3.h:469
spi_specifics.h
This file contains SPI specific macros, functions, etc.
vcpmonitor3_init
err_t vcpmonitor3_init(vcpmonitor3_t *ctx, vcpmonitor3_cfg_t *cfg)
VCP Monitor 3 initialization function.
vcpmonitor3_s::write_f
vcpmonitor3_master_io_t write_f
Definition: vcpmonitor3.h:496
vcpmonitor3_read_tb
float vcpmonitor3_read_tb(vcpmonitor3_t *ctx, uint8_t accu_set1)
Read Time in Seconds function.
vcpmonitor3_master_io_t
err_t(* vcpmonitor3_master_io_t)(struct vcpmonitor3_s *, uint8_t, uint8_t *, uint8_t)
VCP Monitor 3 Click driver interface.
Definition: vcpmonitor3.h:478
vcpmonitor3_s::i2c
i2c_master_t i2c
Definition: vcpmonitor3.h:489
vcpmonitor3_set_op_mode
void vcpmonitor3_set_op_mode(vcpmonitor3_t *ctx, uint8_t op_mode)
Set Operation Mode function.
vcpmonitor3_cfg_t::cs
pin_name_t cs
Definition: vcpmonitor3.h:512
vcpmonitor3_cfg_t::scl
pin_name_t scl
Definition: vcpmonitor3.h:507
vcpmonitor3_read_c
float vcpmonitor3_read_c(vcpmonitor3_t *ctx, uint8_t accu_set1)
Read Charge in Coulombs function.
vcpmonitor3_cfg_t::i2c_speed
uint32_t i2c_speed
Definition: vcpmonitor3.h:516
vcpmonitor3_cfg_t::miso
pin_name_t miso
Definition: vcpmonitor3.h:509
vcpmonitor3_generic_read
err_t vcpmonitor3_generic_read(vcpmonitor3_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
VCP Monitor 3 data reading function.
vcpmonitor3_default_cfg
err_t vcpmonitor3_default_cfg(vcpmonitor3_t *ctx)
VCP Monitor 3 default configuration function.
vcpmonitor3_cfg_t::spi_mode
spi_master_mode_t spi_mode
Definition: vcpmonitor3.h:520
vcpmonitor3_wr_page_1
void vcpmonitor3_wr_page_1(vcpmonitor3_t *ctx, uint8_t reg, uint8_t *wr_data, uint8_t n_bytes)
Write Data To Page 1 function.
VCPMONITOR3_ERROR
@ VCPMONITOR3_ERROR
Definition: vcpmonitor3.h:534
vcpmonitor3_cfg_t::drv_sel
vcpmonitor3_drv_t drv_sel
Definition: vcpmonitor3.h:523
vcpmonitor3_rd_page_0
void vcpmonitor3_rd_page_0(vcpmonitor3_t *ctx, uint8_t reg, uint8_t *rd_data, uint8_t n_bytes)
Read Data From Page 0 function.
vcpmonitor3_read_e
float vcpmonitor3_read_e(vcpmonitor3_t *ctx, uint8_t accu_set1)
Read Energy in Joules function.
vcpmonitor3_drv_interface_selection
void vcpmonitor3_drv_interface_selection(vcpmonitor3_cfg_t *cfg, vcpmonitor3_drv_t drv_sel)
VCP Monitor 3 driver interface setup function.
vcpmonitor3_read_p
float vcpmonitor3_read_p(vcpmonitor3_t *ctx)
Read Power in Watts function.
vcpmonitor3_read_vcc
float vcpmonitor3_read_vcc(vcpmonitor3_t *ctx)
Read Voltage at DVCC in Volts function.
vcpmonitor3_cfg_t::alr
pin_name_t alr
Definition: vcpmonitor3.h:514
vcpmonitor3_s::slave_address
uint8_t slave_address
Definition: vcpmonitor3.h:492
vcpmonitor3_cfg_t::gpio
pin_name_t gpio
Definition: vcpmonitor3.h:513
vcpmonitor3_get_int
uint8_t vcpmonitor3_get_int(vcpmonitor3_t *ctx)
Get Interrupt state function.
vcpmonitor3_s
VCP Monitor 3 Click context object.
Definition: vcpmonitor3.h:485
vcpmonitor3_s::gpio
digital_out_t gpio
Definition: vcpmonitor3.h:486
vcpmonitor3_cfg_setup
void vcpmonitor3_cfg_setup(vcpmonitor3_cfg_t *cfg)
VCP Monitor 3 configuration object setup function.
vcpmonitor3_cfg_t
VCP Monitor 3 Click configuration object.
Definition: vcpmonitor3.h:506
vcpmonitor3_cfg_t::mosi
pin_name_t mosi
Definition: vcpmonitor3.h:510
vcpmonitor3_cfg_t::spi_speed
uint32_t spi_speed
Definition: vcpmonitor3.h:519
vcpmonitor3_rd_page_1
void vcpmonitor3_rd_page_1(vcpmonitor3_t *ctx, uint8_t reg, uint8_t *rd_data, uint8_t n_bytes)
Read Data From Page 1 function.
vcpmonitor3_s::read_f
vcpmonitor3_master_io_t read_f
Definition: vcpmonitor3.h:497
vcpmonitor3_t
struct vcpmonitor3_s vcpmonitor3_t
VCP Monitor 3 Click context object.
vcpmonitor3_s::alr
digital_in_t alr
Definition: vcpmonitor3.h:487
vcpmonitor3_cfg_t::i2c_address
uint8_t i2c_address
Definition: vcpmonitor3.h:517
vcpmonitor3_s::chip_select
pin_name_t chip_select
Definition: vcpmonitor3.h:493
vcpmonitor3_wr_page_0
void vcpmonitor3_wr_page_0(vcpmonitor3_t *ctx, uint8_t reg, uint8_t *wr_data, uint8_t n_bytes)
Write Data To Page 0 function.
vcpmonitor3_read_v
float vcpmonitor3_read_v(vcpmonitor3_t *ctx)
Read Voltage in Volts function.
vcpmonitor3_read_i
float vcpmonitor3_read_i(vcpmonitor3_t *ctx)
Read Current in Amps function.
vcpmonitor3_read_temp
float vcpmonitor3_read_temp(vcpmonitor3_t *ctx)
Read Die Temperature in degrees Centigrade function.