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 "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 
41 // -------------------------------------------------------------- PUBLIC MACROS
51 #define CAPEXTEND3_MAP_MIKROBUS( cfg, mikrobus ) \
52  cfg.to0= MIKROBUS( mikrobus, MIKROBUS_AN ); \
53  cfg.to1= MIKROBUS( mikrobus, MIKROBUS_RST ); \
54  cfg.to2= MIKROBUS( mikrobus, MIKROBUS_CS ); \
55  cfg.to3= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
56  cfg.to4= MIKROBUS( mikrobus, MIKROBUS_INT )
57 
63 #define CAPEXTEND3_RETVAL uint8_t
64 
65 #define CAPEXTEND3_OK 0x00
66 #define CAPEXTEND3_INIT_ERROR 0xFF
67  // End group macro
70 // --------------------------------------------------------------- PUBLIC TYPES
79 typedef struct
80 {
81  // Input pins
82 
83  digital_in_t to0;
84  digital_in_t to1;
85  digital_in_t to2;
86  digital_in_t to3;
87  digital_in_t to4;
88 
89 } capextend3_t;
90 
94 typedef struct
95 {
96  // Additional gpio pins
97 
98  pin_name_t to0;
99  pin_name_t to1;
100  pin_name_t to2;
101  pin_name_t to3;
102  pin_name_t to4;
103 
105  // End types group
107 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
108 
114 #ifdef __cplusplus
115 extern "C"{
116 #endif
117 
127 
136 
146 
156 
166 
176 
186 
187 #ifdef __cplusplus
188 }
189 #endif
190 #endif // _CAPEXTEND3_H_
191  // End public_function group
194 
195 // ------------------------------------------------------------------------- END
capextend3_t::to0
digital_in_t to0
Definition: capextend3.h:83
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:98
capextend3_t::to4
digital_in_t to4
Definition: capextend3.h:87
capextend3_t
Click ctx object definition.
Definition: capextend3.h:80
capextend3_cfg_t
Click configuration structure definition.
Definition: capextend3.h:95
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:84
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:100
capextend3_cfg_t::to1
pin_name_t to1
Definition: capextend3.h:99
CAPEXTEND3_RETVAL
#define CAPEXTEND3_RETVAL
Definition: capextend3.h:63
capextend3_cfg_t::to4
pin_name_t to4
Definition: capextend3.h:102
capextend3_t::to3
digital_in_t to3
Definition: capextend3.h:86
capextend3_t::to2
digital_in_t to2
Definition: capextend3.h:85
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:101