profet10a 2.0.0.0
profet10a.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 PROFET10A_H
29#define PROFET10A_H
30
31#ifdef __cplusplus
32extern "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_analog_in.h"
52
73#define PROFET10A_MODE_ON 1
74#define PROFET10A_MODE_OFF 2
75#define PROFET10A_DIAGNOSTIC_ON 3
76#define PROFET10A_DIAGNOSTIC_OFF 4
77#define PROFET10A_FAULT 5
78
79 // profet10a_set
80
95#define PROFET10A_MAP_MIKROBUS( cfg, mikrobus ) \
96 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
97 cfg.den = MIKROBUS( mikrobus, MIKROBUS_CS ); \
98 cfg.in = MIKROBUS( mikrobus, MIKROBUS_PWM );
99
100 // profet10a_map
101 // profet10a
102
107typedef struct
108{
109 digital_out_t den;
110 digital_out_t in;
112 analog_in_t adc;
114 uint8_t mode;
115 uint16_t rsens;
116 uint16_t kilis;
117 float offset;
120
125typedef struct
126{
127 pin_name_t an;
128 pin_name_t den;
129 pin_name_t in;
131 analog_in_resolution_t resolution;
132 float vref;
135
146
163
179
192err_t profet10a_read_an_pin_value ( profet10a_t *ctx, uint16_t *data_out );
193
208err_t profet10a_read_an_pin_voltage ( profet10a_t *ctx, float *data_out );
209
221err_t profet10a_set_mode ( profet10a_t *ctx, uint8_t mode );
222
223#ifdef __cplusplus
224}
225#endif
226#endif // PROFET10A_H
227
228 // profet10a
229
230// ------------------------------------------------------------------------ END
err_t profet10a_init(profet10a_t *ctx, profet10a_cfg_t *cfg)
PROFET 10A initialization function.
err_t profet10a_read_an_pin_voltage(profet10a_t *ctx, float *data_out)
PROFET 10A read AN pin voltage level function.
void profet10a_cfg_setup(profet10a_cfg_t *cfg)
PROFET 10A configuration object setup function.
err_t profet10a_read_an_pin_value(profet10a_t *ctx, uint16_t *data_out)
PROFET 10A read AN pin value function.
err_t profet10a_set_mode(profet10a_t *ctx, uint8_t mode)
PROFET 10A set mode.
profet10a_return_value_t
PROFET 10A Click return value data.
Definition profet10a.h:141
@ PROFET10A_OK
Definition profet10a.h:142
@ PROFET10A_ERROR
Definition profet10a.h:143
PROFET 10A Click configuration object.
Definition profet10a.h:126
analog_in_resolution_t resolution
Definition profet10a.h:131
float vref
Definition profet10a.h:132
pin_name_t in
Definition profet10a.h:129
pin_name_t den
Definition profet10a.h:128
pin_name_t an
Definition profet10a.h:127
PROFET 10A Click context object.
Definition profet10a.h:108
digital_out_t den
Definition profet10a.h:109
uint8_t mode
Definition profet10a.h:114
float offset
Definition profet10a.h:117
digital_out_t in
Definition profet10a.h:110
uint16_t rsens
Definition profet10a.h:115
uint16_t kilis
Definition profet10a.h:116
analog_in_t adc
Definition profet10a.h:112