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 
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_analog_in.h"
38 
59 #define PRESSURE13_V_REF_2_048_mV 2.04800
60 #define PRESSURE13_V_REF_3_0_mV 3.00000
61 #define PRESSURE13_V_REF_3_3_mV 3.30000
62 #define PRESSURE13_V_REF_CALC_FACT 0.86987
63 
64 #define PRESSURE13_V_DD_3_3_mV 3.30000
65 #define PRESSURE13_V_DD_5_0_mV 5.00000
66 
67 #define PRESSURE13_ADC_RES_10_BIT 1024.00
68 #define PRESSURE13_ADC_RES_12_BIT 4096.00
69 #define PRESSURE13_ADC_RES_14_BIT 16383.0
70 
71 #define PRESSURE13_GAIN_AND_OFFSET_SYMBOL_A 0.00293
72 #define PRESSURE13_GAIN_AND_OFFSET_SYMBOL_B 0.05069
73 
74 #define PRESSURE13_CONVERT_KPAS_TO_MBAR 10.0000
75  // pressure13_set
77 
92 #define PRESSURE13_MAP_MIKROBUS( cfg, mikrobus ) \
93  cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN )
94  // pressure13_map // pressure13
97 
102 typedef struct
103 {
104  analog_in_t adc;
106 } pressure13_t;
107 
112 typedef struct
113 {
114  pin_name_t an;
116  analog_in_resolution_t resolution;
117  float vref;
120 
125 typedef enum
126 {
128  PRESSURE13_ERROR = -1
129 
131 
148 
163 
175 err_t pressure13_read_an_pin_value ( pressure13_t *ctx, uint16_t *data_out );
176 
191 err_t pressure13_read_an_pin_voltage ( pressure13_t *ctx, float *data_out );
192 
204 err_t pressure13_get_pressure ( pressure13_t *ctx, float *data_out );
205 
206 #ifdef __cplusplus
207 }
208 #endif
209 #endif // PRESSURE13_H
210  // pressure13
212 
213 // ------------------------------------------------------------------------ END
pressure13_cfg_t::an
pin_name_t an
Definition: pressure13.h:114
PRESSURE13_ERROR
@ PRESSURE13_ERROR
Definition: pressure13.h:128
pressure13_cfg_t::resolution
analog_in_resolution_t resolution
Definition: pressure13.h:116
pressure13_cfg_t
Pressure 13 Click configuration object.
Definition: pressure13.h:113
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:126
PRESSURE13_OK
@ PRESSURE13_OK
Definition: pressure13.h:127
pressure13_t
Pressure 13 Click context object.
Definition: pressure13.h:103
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:104
pressure13_cfg_t::vref
float vref
Definition: pressure13.h:117
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.