hallcurrent825a  2.0.0.0
hallcurrent825a.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 HALLCURRENT825A_H
29 #define HALLCURRENT825A_H
30 
31 #ifdef __cplusplus
32 extern "C"{
33 #endif
34 
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_analog_in.h"
38 
64 #define HALLCURRENT825A_MAP_MIKROBUS( cfg, mikrobus ) \
65  cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
66  cfg.oc1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
67  cfg.oc2 = MIKROBUS( mikrobus, MIKROBUS_INT )
68  // hallcurrent825a_map // hallcurrent825a
71 
76 typedef struct
77 {
78  digital_in_t oc1;
79  digital_in_t oc2;
81  analog_in_t adc;
84 
89 typedef struct
90 {
91  pin_name_t an;
92  pin_name_t oc1;
93  pin_name_t oc2;
95  analog_in_resolution_t resolution;
96  float vref;
99 
104 typedef struct
105 {
106  float offset;
107 
109 
114 typedef enum
115 {
118 
120 
137 
153 
166 err_t hallcurrent825a_read_an_pin_value ( hallcurrent825a_t *ctx, uint16_t *data_out );
167 
182 err_t hallcurrent825a_read_an_pin_voltage ( hallcurrent825a_t *ctx, float *data_out );
183 
200 
215 err_t hallcurrent825a_get_voltage ( hallcurrent825a_t *ctx, float *avr_voltage );
216 
233 
248 
263 
264 #ifdef __cplusplus
265 }
266 #endif
267 #endif // HALLCURRENT825A_H
268  // hallcurrent825a
270 
271 // ------------------------------------------------------------------------ END
hallcurrent825a_return_value_t
hallcurrent825a_return_value_t
Hall Current 8 25A Click return value data.
Definition: hallcurrent825a.h:113
hallcurrent825a_init
err_t hallcurrent825a_init(hallcurrent825a_t *ctx, hallcurrent825a_cfg_t *cfg)
Hall Current 8 25A initialization function.
hallcurrent825a_read_an_pin_value
err_t hallcurrent825a_read_an_pin_value(hallcurrent825a_t *ctx, uint16_t *data_out)
Hall Current 8 25A read AN pin value function.
hallcurrent825a_get_odc2
uint8_t hallcurrent825a_get_odc2(hallcurrent825a_t *ctx)
Hall Current 8 25A get state of OC2 function.
hallcurrent825a_calibration
err_t hallcurrent825a_calibration(hallcurrent825a_t *ctx, hallcurrent825a_offset_t *offset_val)
Hall Current 8 25A calibration function.
hallcurrent825a_get_odc1
uint8_t hallcurrent825a_get_odc1(hallcurrent825a_t *ctx)
Hall Current 8 25A get state of OC1 function.
hallcurrent825a_get_current
err_t hallcurrent825a_get_current(hallcurrent825a_t *ctx, hallcurrent825a_offset_t *offset_val, float *current)
Hall Current 8 25A get current level function.
HALLCURRENT825A_OK
Definition: hallcurrent825a.h:115
HALLCURRENT825A_ERROR
Definition: hallcurrent825a.h:116
hallcurrent825a_cfg_setup
void hallcurrent825a_cfg_setup(hallcurrent825a_cfg_t *cfg)
Hall Current 8 25A configuration object setup function.
hallcurrent825a_offset_t
Hall Current 8 25A Click configuration object.
Definition: hallcurrent825a.h:103
offset_val
hallcurrent825a_offset_t offset_val
Definition: main.c:34
hallcurrent825a_t
Hall Current 8 25A Click context object.
Definition: hallcurrent825a.h:75
hallcurrent825a_read_an_pin_voltage
err_t hallcurrent825a_read_an_pin_voltage(hallcurrent825a_t *ctx, float *data_out)
Hall Current 8 25A read AN pin voltage level function.
hallcurrent825a_get_voltage
err_t hallcurrent825a_get_voltage(hallcurrent825a_t *ctx, float *avr_voltage)
Hall Current 8 25A read voltage level function.
hallcurrent825a_cfg_t
Hall Current 8 25A Click configuration object.
Definition: hallcurrent825a.h:88