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 "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 
41 // -------------------------------------------------------------- PUBLIC MACROS
51 #define C2X30WAMP_MAP_MIKROBUS( cfg, mikrobus ) \
52  cfg.rst= MIKROBUS( mikrobus, MIKROBUS_RST ); \
53  cfg.mt= MIKROBUS( mikrobus, MIKROBUS_CS ); \
54  cfg.flt= MIKROBUS( mikrobus, MIKROBUS_INT );
55 
61 #define C2X30WAMP_RETVAL int8_t
62 
63 #define C2X30WAMP_OK 0
64 #define C2X30WAMP_INIT_ERROR (-1)
65 
71 #define C2X30WAMP_ENABLE 1
72 #define C2X30WAMP_DISABLE 0
73 #define C2X30WAMP_MUTE 1
74 #define C2X30WAMP_UNMUTE 0
75  // End group macro
78 // --------------------------------------------------------------- PUBLIC TYPES
87 typedef struct
88 {
89  // Output pins
90 
91  digital_out_t rst;
92  digital_out_t mt;
93 
94  // Input pins
95 
96  digital_in_t flt;
97 
98 } c2x30wamp_t;
99 
103 typedef struct
104 {
105  // Additional gpio pins
106 
107  pin_name_t rst;
108  pin_name_t mt;
109  pin_name_t flt;
110 
112  // End types group
114 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
115 
121 #ifdef __cplusplus
122 extern "C"{
123 #endif
124 
134 
143 
152 void c2x30wamp_enable ( c2x30wamp_t *ctx, uint8_t state );
153 
162 void c2x30wamp_mute ( c2x30wamp_t *ctx, uint8_t state );
163 
173 uint8_t c2x30wamp_check_diagnostic ( c2x30wamp_t *ctx );
174 
175 #ifdef __cplusplus
176 }
177 #endif
178 #endif // C2X30WAMP_H
179  // End public_function group // End click Driver group
182 
183 // ------------------------------------------------------------------------- END
c2x30wamp_mute
void c2x30wamp_mute(c2x30wamp_t *ctx, uint8_t state)
Device Mute function.
c2x30wamp_t
Click ctx object definition.
Definition: c2x30wamp.h:87
c2x30wamp_cfg_t::rst
pin_name_t rst
Definition: c2x30wamp.h:107
c2x30wamp_t::mt
digital_out_t mt
Definition: c2x30wamp.h:92
c2x30wamp_t::flt
digital_in_t flt
Definition: c2x30wamp.h:96
c2x30wamp_t::rst
digital_out_t rst
Definition: c2x30wamp.h:91
c2x30wamp_cfg_t::flt
pin_name_t flt
Definition: c2x30wamp.h:109
c2x30wamp_cfg_t
Click configuration structure definition.
Definition: c2x30wamp.h:103
c2x30wamp_init
C2X30WAMP_RETVAL c2x30wamp_init(c2x30wamp_t *ctx, c2x30wamp_cfg_t *cfg)
Initialization function.
C2X30WAMP_RETVAL
#define C2X30WAMP_RETVAL
Definition: c2x30wamp.h:61
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:108
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.