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 
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_digital_out.h"
53 #include "drv_digital_in.h"
54 
55 // -------------------------------------------------------------- PUBLIC MACROS
65 #define C2X30WAMP_MAP_MIKROBUS( cfg, mikrobus ) \
66  cfg.rst= MIKROBUS( mikrobus, MIKROBUS_RST ); \
67  cfg.mt= MIKROBUS( mikrobus, MIKROBUS_CS ); \
68  cfg.flt= MIKROBUS( mikrobus, MIKROBUS_INT );
69 
75 #define C2X30WAMP_RETVAL int8_t
76 
77 #define C2X30WAMP_OK 0
78 #define C2X30WAMP_INIT_ERROR (-1)
79 
85 #define C2X30WAMP_ENABLE 1
86 #define C2X30WAMP_DISABLE 0
87 #define C2X30WAMP_MUTE 1
88 #define C2X30WAMP_UNMUTE 0
89  // End group macro
92 // --------------------------------------------------------------- PUBLIC TYPES
101 typedef struct
102 {
103  // Output pins
104 
105  digital_out_t rst;
106  digital_out_t mt;
107 
108  // Input pins
109 
110  digital_in_t flt;
111 
112 } c2x30wamp_t;
113 
117 typedef struct
118 {
119  // Additional gpio pins
120 
121  pin_name_t rst;
122  pin_name_t mt;
123  pin_name_t flt;
124 
126  // End types group
128 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
129 
135 #ifdef __cplusplus
136 extern "C"{
137 #endif
138 
148 
157 
166 void c2x30wamp_enable ( c2x30wamp_t *ctx, uint8_t state );
167 
176 void c2x30wamp_mute ( c2x30wamp_t *ctx, uint8_t state );
177 
188 
189 #ifdef __cplusplus
190 }
191 #endif
192 #endif // C2X30WAMP_H
193  // End public_function group // End Click Driver group
196 
197 // ------------------------------------------------------------------------- END
c2x30wamp_mute
void c2x30wamp_mute(c2x30wamp_t *ctx, uint8_t state)
Device Mute function.
c2x30wamp_t
Click ctx object definition.
Definition: c2x30wamp.h:102
c2x30wamp_cfg_t::rst
pin_name_t rst
Definition: c2x30wamp.h:121
c2x30wamp_t::mt
digital_out_t mt
Definition: c2x30wamp.h:106
c2x30wamp_t::flt
digital_in_t flt
Definition: c2x30wamp.h:110
c2x30wamp_t::rst
digital_out_t rst
Definition: c2x30wamp.h:105
c2x30wamp_cfg_t::flt
pin_name_t flt
Definition: c2x30wamp.h:123
c2x30wamp_cfg_t
Click configuration structure definition.
Definition: c2x30wamp.h:118
c2x30wamp_init
C2X30WAMP_RETVAL c2x30wamp_init(c2x30wamp_t *ctx, c2x30wamp_cfg_t *cfg)
Initialization function.
C2X30WAMP_RETVAL
#define C2X30WAMP_RETVAL
Definition: c2x30wamp.h:75
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:122
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.