pressure13  2.0.0.0
pressure13.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2021 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 PRESSURE13_H
29 #define PRESSURE13_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_analog_in.h"
52 
73 #define PRESSURE13_V_REF_2_048_mV 2.04800
74 #define PRESSURE13_V_REF_3_0_mV 3.00000
75 #define PRESSURE13_V_REF_3_3_mV 3.30000
76 #define PRESSURE13_V_REF_CALC_FACT 0.86987
77 
78 #define PRESSURE13_V_DD_3_3_mV 3.30000
79 #define PRESSURE13_V_DD_5_0_mV 5.00000
80 
81 #define PRESSURE13_ADC_RES_10_BIT 1024.00
82 #define PRESSURE13_ADC_RES_12_BIT 4096.00
83 #define PRESSURE13_ADC_RES_14_BIT 16383.0
84 
85 #define PRESSURE13_GAIN_AND_OFFSET_SYMBOL_A 0.00293
86 #define PRESSURE13_GAIN_AND_OFFSET_SYMBOL_B 0.05069
87 
88 #define PRESSURE13_CONVERT_KPAS_TO_MBAR 10.0000
89  // pressure13_set
91 
106 #define PRESSURE13_MAP_MIKROBUS( cfg, mikrobus ) \
107  cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN )
108  // pressure13_map // pressure13
111 
116 typedef struct
117 {
118  analog_in_t adc;
120 } pressure13_t;
121 
126 typedef struct
127 {
128  pin_name_t an;
130  analog_in_resolution_t resolution;
131  float vref;
134 
139 typedef enum
140 {
142  PRESSURE13_ERROR = -1
143 
145 
162 
177 
189 err_t pressure13_read_an_pin_value ( pressure13_t *ctx, uint16_t *data_out );
190 
205 err_t pressure13_read_an_pin_voltage ( pressure13_t *ctx, float *data_out );
206 
218 err_t pressure13_get_pressure ( pressure13_t *ctx, float *data_out );
219 
220 #ifdef __cplusplus
221 }
222 #endif
223 #endif // PRESSURE13_H
224  // pressure13
226 
227 // ------------------------------------------------------------------------ END
pressure13_cfg_t::an
pin_name_t an
Definition: pressure13.h:128
PRESSURE13_ERROR
@ PRESSURE13_ERROR
Definition: pressure13.h:142
pressure13_cfg_t::resolution
analog_in_resolution_t resolution
Definition: pressure13.h:130
pressure13_cfg_t
Pressure 13 Click configuration object.
Definition: pressure13.h:127
pressure13_read_an_pin_value
err_t pressure13_read_an_pin_value(pressure13_t *ctx, uint16_t *data_out)
Pressure 13 read AN pin value function.
pressure13_read_an_pin_voltage
err_t pressure13_read_an_pin_voltage(pressure13_t *ctx, float *data_out)
Pressure 13 read AN pin voltage level function.
pressure13_return_value_t
pressure13_return_value_t
Pressure 13 Click return value data.
Definition: pressure13.h:140
PRESSURE13_OK
@ PRESSURE13_OK
Definition: pressure13.h:141
pressure13_t
Pressure 13 Click context object.
Definition: pressure13.h:117
pressure13_get_pressure
err_t pressure13_get_pressure(pressure13_t *ctx, float *data_out)
Pressure 13 get pressure function.
pressure13_t::adc
analog_in_t adc
Definition: pressure13.h:118
pressure13_cfg_t::vref
float vref
Definition: pressure13.h:131
pressure13_init
err_t pressure13_init(pressure13_t *ctx, pressure13_cfg_t *cfg)
Pressure 13 initialization function.
pressure13_cfg_setup
void pressure13_cfg_setup(pressure13_cfg_t *cfg)
Pressure 13 configuration object setup function.