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 "mikrosdk_version.h"
36 
37 #ifdef __GNUC__
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
40 #else
41 #include "delays.h"
42 #endif
43 #endif
44 
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_analog_in.h"
48 
69 #define PRESSURE13_V_REF_2_048_mV 2.04800
70 #define PRESSURE13_V_REF_3_0_mV 3.00000
71 #define PRESSURE13_V_REF_3_3_mV 3.30000
72 #define PRESSURE13_V_REF_CALC_FACT 0.86987
73 
74 #define PRESSURE13_V_DD_3_3_mV 3.30000
75 #define PRESSURE13_V_DD_5_0_mV 5.00000
76 
77 #define PRESSURE13_ADC_RES_10_BIT 1024.00
78 #define PRESSURE13_ADC_RES_12_BIT 4096.00
79 #define PRESSURE13_ADC_RES_14_BIT 16383.0
80 
81 #define PRESSURE13_GAIN_AND_OFFSET_SYMBOL_A 0.00293
82 #define PRESSURE13_GAIN_AND_OFFSET_SYMBOL_B 0.05069
83 
84 #define PRESSURE13_CONVERT_KPAS_TO_MBAR 10.0000
85  // pressure13_set
87 
102 #define PRESSURE13_MAP_MIKROBUS( cfg, mikrobus ) \
103  cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN )
104  // pressure13_map // pressure13
107 
112 typedef struct
113 {
114  analog_in_t adc;
116 } pressure13_t;
117 
122 typedef struct
123 {
124  pin_name_t an;
126  analog_in_resolution_t resolution;
127  float vref;
130 
135 typedef enum
136 {
138  PRESSURE13_ERROR = -1
139 
141 
158 
173 
185 err_t pressure13_read_an_pin_value ( pressure13_t *ctx, uint16_t *data_out );
186 
201 err_t pressure13_read_an_pin_voltage ( pressure13_t *ctx, float *data_out );
202 
214 err_t pressure13_get_pressure ( pressure13_t *ctx, float *data_out );
215 
216 #ifdef __cplusplus
217 }
218 #endif
219 #endif // PRESSURE13_H
220  // pressure13
222 
223 // ------------------------------------------------------------------------ END
pressure13_cfg_t::an
pin_name_t an
Definition: pressure13.h:124
PRESSURE13_ERROR
@ PRESSURE13_ERROR
Definition: pressure13.h:138
pressure13_cfg_t::resolution
analog_in_resolution_t resolution
Definition: pressure13.h:126
pressure13_cfg_t
Pressure 13 Click configuration object.
Definition: pressure13.h:123
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:136
PRESSURE13_OK
@ PRESSURE13_OK
Definition: pressure13.h:137
pressure13_t
Pressure 13 Click context object.
Definition: pressure13.h:113
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:114
pressure13_cfg_t::vref
float vref
Definition: pressure13.h:127
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.