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_50 50
60 #define MICROWAVE_THRESHOLD_100 100
61 #define MICROWAVE_THRESHOLD_200 200
62 #define MICROWAVE_THRESHOLD_500 500
63 
69 #define MICROWAVE_MAP_MIKROBUS( cfg, mikrobus ) \
70  cfg.out = MIKROBUS( mikrobus, MIKROBUS_AN )
71  // End macros group
74 // --------------------------------------------------------------- PUBLIC TYPES
83 typedef uint16_t microwave_data_t;
84 
88 typedef enum
89 {
90  MICROWAVE_OK = 0x0,
92 
94 
98 typedef struct
99 {
100  analog_in_t adc;
101 
102 } microwave_t;
103 
107 typedef struct
108 {
109  // Analog gpio pin.
110  pin_name_t out;
111 
112  // Configuration variables.
113  analog_in_resolution_t resolution; // Resolution
114  float vref; // VRef
115 
117  // End types group
119 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
125 #ifdef __cplusplus
126 extern "C"{
127 #endif
128 
141 void
143 
157 
170 
171 #ifdef __cplusplus
172 }
173 #endif
174 #endif // _MICROWAVE_H_
175  // End public_function group
178 
179 // ------------------------------------------------------------------------ END
Click configuration structure definition.
Definition: microwave.h:107
float vref
Definition: microwave.h:114
Click context object definition.
Definition: microwave.h:98
Definition: microwave.h:90
Definition: microwave.h:91
microwave_err_t microwave_init(microwave_t *ctx, microwave_cfg_t *cfg)
Click Initialization function.
pin_name_t out
Definition: microwave.h:110
microwave_err_t
Click code error definition.
Definition: microwave.h:88
analog_in_resolution_t resolution
Definition: microwave.h:113
microwave_data_t microwave_generic_read(microwave_t *ctx)
Generic ADC Read function.
uint16_t microwave_data_t
Analog data type.
Definition: microwave.h:83
analog_in_t adc
Definition: microwave.h:100
void microwave_cfg_setup(microwave_cfg_t *cfg)
Configuration Object Setup function.