c2x30wamp  2.0.0.0
c2x30wamp.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 
33 // ----------------------------------------------------------------------------
34 
35 #ifndef C2X30WAMP_H
36 #define C2X30WAMP_H
37 
38 #include "mikrosdk_version.h"
39 
40 #ifdef __GNUC__
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
43 #else
44 #include "delays.h"
45 #endif
46 #endif
47 
48 #include "drv_digital_out.h"
49 #include "drv_digital_in.h"
50 
51 // -------------------------------------------------------------- PUBLIC MACROS
61 #define C2X30WAMP_MAP_MIKROBUS( cfg, mikrobus ) \
62  cfg.rst= MIKROBUS( mikrobus, MIKROBUS_RST ); \
63  cfg.mt= MIKROBUS( mikrobus, MIKROBUS_CS ); \
64  cfg.flt= MIKROBUS( mikrobus, MIKROBUS_INT );
65 
71 #define C2X30WAMP_RETVAL int8_t
72 
73 #define C2X30WAMP_OK 0
74 #define C2X30WAMP_INIT_ERROR (-1)
75 
81 #define C2X30WAMP_ENABLE 1
82 #define C2X30WAMP_DISABLE 0
83 #define C2X30WAMP_MUTE 1
84 #define C2X30WAMP_UNMUTE 0
85  // End group macro
88 // --------------------------------------------------------------- PUBLIC TYPES
97 typedef struct
98 {
99  // Output pins
100 
101  digital_out_t rst;
102  digital_out_t mt;
103 
104  // Input pins
105 
106  digital_in_t flt;
107 
108 } c2x30wamp_t;
109 
113 typedef struct
114 {
115  // Additional gpio pins
116 
117  pin_name_t rst;
118  pin_name_t mt;
119  pin_name_t flt;
120 
122  // End types group
124 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
125 
131 #ifdef __cplusplus
132 extern "C"{
133 #endif
134 
144 
153 
162 void c2x30wamp_enable ( c2x30wamp_t *ctx, uint8_t state );
163 
172 void c2x30wamp_mute ( c2x30wamp_t *ctx, uint8_t state );
173 
184 
185 #ifdef __cplusplus
186 }
187 #endif
188 #endif // C2X30WAMP_H
189  // End public_function group // End click Driver group
192 
193 // ------------------------------------------------------------------------- END
c2x30wamp_mute
void c2x30wamp_mute(c2x30wamp_t *ctx, uint8_t state)
Device Mute function.
c2x30wamp_t
Click ctx object definition.
Definition: c2x30wamp.h:98
c2x30wamp_cfg_t::rst
pin_name_t rst
Definition: c2x30wamp.h:117
c2x30wamp_t::mt
digital_out_t mt
Definition: c2x30wamp.h:102
c2x30wamp_t::flt
digital_in_t flt
Definition: c2x30wamp.h:106
c2x30wamp_t::rst
digital_out_t rst
Definition: c2x30wamp.h:101
c2x30wamp_cfg_t::flt
pin_name_t flt
Definition: c2x30wamp.h:119
c2x30wamp_cfg_t
Click configuration structure definition.
Definition: c2x30wamp.h:114
c2x30wamp_init
C2X30WAMP_RETVAL c2x30wamp_init(c2x30wamp_t *ctx, c2x30wamp_cfg_t *cfg)
Initialization function.
C2X30WAMP_RETVAL
#define C2X30WAMP_RETVAL
Definition: c2x30wamp.h:71
c2x30wamp_cfg_setup
void c2x30wamp_cfg_setup(c2x30wamp_cfg_t *cfg)
Config Object Initialization function.
c2x30wamp_cfg_t::mt
pin_name_t mt
Definition: c2x30wamp.h:118
c2x30wamp_enable
void c2x30wamp_enable(c2x30wamp_t *ctx, uint8_t state)
Device Enable function.
c2x30wamp_check_diagnostic
uint8_t c2x30wamp_check_diagnostic(c2x30wamp_t *ctx)
Diagnostic Check function.