capextend3  2.0.0.0
capextend3.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 CAPEXTEND3_H
36 #define CAPEXTEND3_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 CAPEXTEND3_MAP_MIKROBUS( cfg, mikrobus ) \
62  cfg.to0= MIKROBUS( mikrobus, MIKROBUS_AN ); \
63  cfg.to1= MIKROBUS( mikrobus, MIKROBUS_RST ); \
64  cfg.to2= MIKROBUS( mikrobus, MIKROBUS_CS ); \
65  cfg.to3= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
66  cfg.to4= MIKROBUS( mikrobus, MIKROBUS_INT )
67 
73 #define CAPEXTEND3_RETVAL uint8_t
74 
75 #define CAPEXTEND3_OK 0x00
76 #define CAPEXTEND3_INIT_ERROR 0xFF
77  // End group macro
80 // --------------------------------------------------------------- PUBLIC TYPES
89 typedef struct
90 {
91  // Input pins
92 
93  digital_in_t to0;
94  digital_in_t to1;
95  digital_in_t to2;
96  digital_in_t to3;
97  digital_in_t to4;
98 
99 } capextend3_t;
100 
104 typedef struct
105 {
106  // Additional gpio pins
107 
108  pin_name_t to0;
109  pin_name_t to1;
110  pin_name_t to2;
111  pin_name_t to3;
112  pin_name_t to4;
113 
115  // End types group
117 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
118 
124 #ifdef __cplusplus
125 extern "C"{
126 #endif
127 
137 
146 
156 
166 
176 
186 
196 
197 #ifdef __cplusplus
198 }
199 #endif
200 #endif // _CAPEXTEND3_H_
201  // End public_function group
204 
205 // ------------------------------------------------------------------------- END
capextend3_t::to0
digital_in_t to0
Definition: capextend3.h:93
capextend3_touch_4
uint8_t capextend3_touch_4(capextend3_t *ctx)
Function reads state of PWM pin.
capextend3_cfg_setup
void capextend3_cfg_setup(capextend3_cfg_t *cfg)
Config Object Initialization function.
capextend3_cfg_t::to0
pin_name_t to0
Definition: capextend3.h:108
capextend3_t::to4
digital_in_t to4
Definition: capextend3.h:97
capextend3_t
Click ctx object definition.
Definition: capextend3.h:90
capextend3_cfg_t
Click configuration structure definition.
Definition: capextend3.h:105
capextend3_touch_3
uint8_t capextend3_touch_3(capextend3_t *ctx)
Function reads state of INT pin.
capextend3_init
CAPEXTEND3_RETVAL capextend3_init(capextend3_t *ctx, capextend3_cfg_t *cfg)
Initialization function.
capextend3_t::to1
digital_in_t to1
Definition: capextend3.h:94
capextend3_touch_1
uint8_t capextend3_touch_1(capextend3_t *ctx)
Function reads state of RST pin.
capextend3_touch_0
uint8_t capextend3_touch_0(capextend3_t *ctx)
Function reads state of AN pin.
capextend3_cfg_t::to2
pin_name_t to2
Definition: capextend3.h:110
capextend3_cfg_t::to1
pin_name_t to1
Definition: capextend3.h:109
CAPEXTEND3_RETVAL
#define CAPEXTEND3_RETVAL
Definition: capextend3.h:73
capextend3_cfg_t::to4
pin_name_t to4
Definition: capextend3.h:112
capextend3_t::to3
digital_in_t to3
Definition: capextend3.h:96
capextend3_t::to2
digital_in_t to2
Definition: capextend3.h:95
capextend3_touch_2
uint8_t capextend3_touch_2(capextend3_t *ctx)
Function reads state of CS pin.
capextend3_cfg_t::to3
pin_name_t to3
Definition: capextend3.h:111