mic3  2.0.0.0
mic3.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2020 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 MIC3_H
29 #define MIC3_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 
68 #define MIC3_PIN_STATE_HIGH 0x01
69 #define MIC3_PIN_STATE_LOW 0x00
70  // mic3_set
72 
87 #define MIC3_MAP_MIKROBUS( cfg, mikrobus ) \
88  cfg.shd = MIKROBUS( mikrobus, MIKROBUS_CS )
89  // mic3_map // mic3
92 
97 typedef struct
98 {
99  digital_out_t shd;
101 } mic3_t;
102 
107 typedef struct
108 {
109  pin_name_t shd;
112 } mic3_cfg_t;
113 
118 typedef enum
119 {
120  MIC3_OK = 0,
121  MIC3_ERROR = -1
122 
124 
141 
155 err_t mic3_init ( mic3_t *ctx, mic3_cfg_t *cfg );
156 
170 err_t mic3_default_cfg ( mic3_t *ctx );
171 
181 void mic3_shd_pin_set ( mic3_t *ctx, uint8_t state );
182 
183 #ifdef __cplusplus
184 }
185 #endif
186 #endif // MIC3_H
187  // mic3
189 
190 // ------------------------------------------------------------------------ END
MIC3_OK
@ MIC3_OK
Definition: mic3.h:120
mic3_cfg_t::shd
pin_name_t shd
Definition: mic3.h:109
mic3_return_value_t
mic3_return_value_t
MIC 3 Click return value data.
Definition: mic3.h:119
mic3_t::shd
digital_out_t shd
Definition: mic3.h:99
mic3_default_cfg
err_t mic3_default_cfg(mic3_t *ctx)
MIC 3 default configuration function.
mic3_t
MIC 3 Click context object.
Definition: mic3.h:98
mic3_cfg_setup
void mic3_cfg_setup(mic3_cfg_t *cfg)
MIC 3 configuration object setup function.
mic3_shd_pin_set
void mic3_shd_pin_set(mic3_t *ctx, uint8_t state)
MIC 3 SHD pin setting function.
mic3_init
err_t mic3_init(mic3_t *ctx, mic3_cfg_t *cfg)
MIC 3 initialization function.
MIC3_ERROR
@ MIC3_ERROR
Definition: mic3.h:121
mic3_cfg_t
MIC 3 Click configuration object.
Definition: mic3.h:108