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
42#ifdef PREINIT_SUPPORTED
43#include "preinit.h"
44#endif
45
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
48 #include "delays.h"
49 #endif
50#endif
51
52#include "drv_analog_in.h"
53
54// -------------------------------------------------------------- PUBLIC MACROS
64#define MICROWAVE_SAMPLES_COUNT_50 50
65#define MICROWAVE_SAMPLES_COUNT_100 100
66#define MICROWAVE_SAMPLES_COUNT_200 200
73#define MICROWAVE_THRESHOLD_10 10
74#define MICROWAVE_THRESHOLD_25 25
75#define MICROWAVE_THRESHOLD_50 50
76#define MICROWAVE_THRESHOLD_100 100
77#define MICROWAVE_THRESHOLD_200 200
78#define MICROWAVE_THRESHOLD_500 500
85#define MICROWAVE_MAP_MIKROBUS( cfg, mikrobus ) \
86 cfg.out = MIKROBUS( mikrobus, MIKROBUS_AN )
89 // End macros group
90// --------------------------------------------------------------- PUBLIC TYPES
99typedef uint16_t microwave_data_t;
100
104typedef enum
105{
108
110
114typedef struct
115{
116 analog_in_t adc;
117
119
123typedef struct
124{
125 // Analog gpio pin.
126 pin_name_t out;
127
128 // Configuration variables.
129 analog_in_resolution_t resolution; // Resolution
130 float vref; // VRef
131
133
134 // End types group
135// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
141#ifdef __cplusplus
142extern "C"{
143#endif
144
157void
159
173
186
187#ifdef __cplusplus
188}
189#endif
190#endif // _MICROWAVE_H_
191
192 // End public_function group
194
195// ------------------------------------------------------------------------ END
microwave_err_t microwave_init(microwave_t *ctx, microwave_cfg_t *cfg)
Click Initialization function.
microwave_data_t microwave_generic_read(microwave_t *ctx)
Generic ADC Read function.
void microwave_cfg_setup(microwave_cfg_t *cfg)
Configuration Object Setup function.
microwave_err_t
Click code error definition.
Definition microwave.h:105
uint16_t microwave_data_t
Analog data type.
Definition microwave.h:99
@ MICROWAVE_ERR_INIT_ADC
Definition microwave.h:107
@ MICROWAVE_OK
Definition microwave.h:106
Click configuration structure definition.
Definition microwave.h:124
pin_name_t out
Definition microwave.h:126
analog_in_resolution_t resolution
Definition microwave.h:129
float vref
Definition microwave.h:130
Click context object definition.
Definition microwave.h:115
analog_in_t adc
Definition microwave.h:116