profet15a  2.0.0.0
profet15a.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 PROFET15A_H
29 #define PROFET15A_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 
59 #define PROFET15A_MODE_ON 1
60 #define PROFET15A_MODE_OFF 2
61 #define PROFET15A_DIAGNOSTIC_ON 3
62 #define PROFET15A_DIAGNOSTIC_OFF 4
63 #define PROFET15A_FAULT 5
64  // profet15a_set
66 
81 #define PROFET15A_MAP_MIKROBUS( cfg, mikrobus ) \
82  cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
83  cfg.den = MIKROBUS( mikrobus, MIKROBUS_CS ); \
84  cfg.in = MIKROBUS( mikrobus, MIKROBUS_PWM );
85  // profet15a_map // profet15a
88 
93 typedef struct
94 {
95  digital_out_t den;
96  digital_out_t in;
98  analog_in_t adc;
100  uint8_t mode;
101  uint16_t rsens;
102  uint16_t kilis;
103  float offset;
105 } profet15a_t;
106 
111 typedef struct
112 {
113  pin_name_t an;
114  pin_name_t den;
115  pin_name_t in;
117  analog_in_resolution_t resolution;
118  float vref;
121 
126 typedef enum
127 {
129  PROFET15A_ERROR = -1
130 
132 
149 
165 
178 err_t profet15a_read_an_pin_value ( profet15a_t *ctx, uint16_t *data_out );
179 
194 err_t profet15a_read_an_pin_voltage ( profet15a_t *ctx, float *data_out );
195 
207 err_t profet15a_set_mode ( profet15a_t *ctx, uint8_t mode );
208 
209 #ifdef __cplusplus
210 }
211 #endif
212 #endif // PROFET15A_H
213  // profet15a
215 
216 // ------------------------------------------------------------------------ END
PROFET15A_OK
@ PROFET15A_OK
Definition: profet15a.h:128
profet15a_read_an_pin_value
err_t profet15a_read_an_pin_value(profet15a_t *ctx, uint16_t *data_out)
PROFET 15A read AN pin value function.
profet15a_t::mode
uint8_t mode
Definition: profet15a.h:100
profet15a_t::den
digital_out_t den
Definition: profet15a.h:95
profet15a_t::adc
analog_in_t adc
Definition: profet15a.h:98
profet15a_t::in
digital_out_t in
Definition: profet15a.h:96
profet15a_cfg_t
PROFET 15A Click configuration object.
Definition: profet15a.h:112
profet15a_set_mode
err_t profet15a_set_mode(profet15a_t *ctx, uint8_t mode)
PROFET 15A set mode.
profet15a_read_an_pin_voltage
err_t profet15a_read_an_pin_voltage(profet15a_t *ctx, float *data_out)
PROFET 15A read AN pin voltage level function.
profet15a_cfg_t::den
pin_name_t den
Definition: profet15a.h:114
profet15a_t::kilis
uint16_t kilis
Definition: profet15a.h:102
profet15a_cfg_t::vref
float vref
Definition: profet15a.h:118
profet15a_t::rsens
uint16_t rsens
Definition: profet15a.h:101
profet15a_return_value_t
profet15a_return_value_t
PROFET 15A Click return value data.
Definition: profet15a.h:127
profet15a_t::offset
float offset
Definition: profet15a.h:103
profet15a_init
err_t profet15a_init(profet15a_t *ctx, profet15a_cfg_t *cfg)
PROFET 15A initialization function.
profet15a_cfg_setup
void profet15a_cfg_setup(profet15a_cfg_t *cfg)
PROFET 15A configuration object setup function.
profet15a_cfg_t::in
pin_name_t in
Definition: profet15a.h:115
profet15a_t
PROFET 15A Click context object.
Definition: profet15a.h:94
profet15a_cfg_t::an
pin_name_t an
Definition: profet15a.h:113
profet15a_cfg_t::resolution
analog_in_resolution_t resolution
Definition: profet15a.h:117
PROFET15A_ERROR
@ PROFET15A_ERROR
Definition: profet15a.h:129