pressure12 2.0.0.0
pressure12.h
Go to the documentation of this file.
1/*
2 * MikroSDK - MikroE Software Development Kit
3 * Copyright© 2020 MikroElektronika d.o.o.
4 *
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without restriction,
8 * including without limitation the rights to use, copy, modify, merge,
9 * publish, distribute, sublicense, and/or sell copies of the Software,
10 * and to permit persons to whom the Software is furnished to do so,
11 * subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22 * OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
35#ifndef PRESSURE12_H
36#define PRESSURE12_H
37
38#include "drv_analog_in.h"
39
40// -------------------------------------------------------------- PUBLIC MACROS
41
51#define PRESSURE12_MAP_MIKROBUS( cfg, mikrobus ) \
52 cfg.an_pin = MIKROBUS( mikrobus, MIKROBUS_AN ) // End group macro
56// --------------------------------------------------------------- PUBLIC TYPES
65typedef struct
66{
67 // Modules
68
69 analog_in_t adc;
70
72
76typedef struct
77{
78 // Communication gpio pins
79
80 pin_name_t an_pin;
81
82 // Config variables
83
84 analog_in_resolution_t resolution;
85 float vref;
88 // End types group
90
91// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
92
98#ifdef __cplusplus
99extern "C"{
100#endif
101
112
127
138err_t pressure12_read_pin_adc ( pressure12_t *ctx, uint16_t *data_out );
139
150err_t pressure12_read_pin_voltage ( pressure12_t *ctx, float *data_out );
151
163err_t pressure12_get_pressure ( pressure12_t *ctx, uint16_t *data_out );
164
165#ifdef __cplusplus
166}
167#endif
168#endif // _PRESSURE12_H_
169 // End public_function group
172
173// ------------------------------------------------------------------------ END
void pressure12_cfg_setup(pressure12_cfg_t *cfg)
Config Object Initialization function.
err_t pressure12_read_pin_voltage(pressure12_t *ctx, float *data_out)
Generic function for read voltage.
err_t pressure12_get_pressure(pressure12_t *ctx, uint16_t *data_out)
Get pressure function.
err_t pressure12_init(pressure12_t *ctx, pressure12_cfg_t *cfg)
Initialization function.
err_t pressure12_read_pin_adc(pressure12_t *ctx, uint16_t *data_out)
Generic read function.
Click configuration structure definition.
Definition: pressure12.h:77
analog_in_resolution_t resolution
Definition: pressure12.h:84
float vref
Definition: pressure12.h:85
pin_name_t an_pin
Definition: pressure12.h:80
Click ctx object definition.
Definition: pressure12.h:66
analog_in_t adc
Definition: pressure12.h:69