microwave  2.0.0.0
microwave.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 _MICROWAVE_H_
36 #define _MICROWAVE_H_
37 
38 #include "drv_analog_in.h"
39 
40 // -------------------------------------------------------------- PUBLIC MACROS
50 #define MICROWAVE_SAMPLES_COUNT_50 50
51 #define MICROWAVE_SAMPLES_COUNT_100 100
52 #define MICROWAVE_SAMPLES_COUNT_200 200
53 
59 #define MICROWAVE_THRESHOLD_10 10
60 #define MICROWAVE_THRESHOLD_25 25
61 #define MICROWAVE_THRESHOLD_50 50
62 #define MICROWAVE_THRESHOLD_100 100
63 #define MICROWAVE_THRESHOLD_200 200
64 #define MICROWAVE_THRESHOLD_500 500
65 
71 #define MICROWAVE_MAP_MIKROBUS( cfg, mikrobus ) \
72  cfg.out = MIKROBUS( mikrobus, MIKROBUS_AN )
73  // End macros group
76 // --------------------------------------------------------------- PUBLIC TYPES
85 typedef uint16_t microwave_data_t;
86 
90 typedef enum
91 {
92  MICROWAVE_OK = 0x0,
94 
96 
100 typedef struct
101 {
102  analog_in_t adc;
103 
104 } microwave_t;
105 
109 typedef struct
110 {
111  // Analog gpio pin.
112  pin_name_t out;
113 
114  // Configuration variables.
115  analog_in_resolution_t resolution; // Resolution
116  float vref; // VRef
117 
119  // End types group
121 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
127 #ifdef __cplusplus
128 extern "C"{
129 #endif
130 
143 void
145 
159 
172 
173 #ifdef __cplusplus
174 }
175 #endif
176 #endif // _MICROWAVE_H_
177  // End public_function group
180 
181 // ------------------------------------------------------------------------ END
microwave_data_t
uint16_t microwave_data_t
Analog data type.
Definition: microwave.h:85
MICROWAVE_ERR_INIT_ADC
Definition: microwave.h:93
microwave_cfg_t::vref
float vref
Definition: microwave.h:116
microwave_t::adc
analog_in_t adc
Definition: microwave.h:102
microwave_cfg_t::resolution
analog_in_resolution_t resolution
Definition: microwave.h:115
microwave_cfg_setup
void microwave_cfg_setup(microwave_cfg_t *cfg)
Configuration Object Setup function.
microwave_init
microwave_err_t microwave_init(microwave_t *ctx, microwave_cfg_t *cfg)
Click Initialization function.
microwave_cfg_t
Click configuration structure definition.
Definition: microwave.h:109
MICROWAVE_OK
Definition: microwave.h:92
microwave_err_t
microwave_err_t
Click code error definition.
Definition: microwave.h:90
microwave_generic_read
microwave_data_t microwave_generic_read(microwave_t *ctx)
Generic ADC Read function.
microwave_t
Click context object definition.
Definition: microwave.h:100
microwave_cfg_t::out
pin_name_t out
Definition: microwave.h:112