c2x2key 2.0.0.0
c2x2key.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 C2X2KEY_H
36#define C2X2KEY_H
37
38#include "drv_digital_out.h"
39#include "drv_digital_in.h"
40
41// -------------------------------------------------------------- PUBLIC MACROS
51#define C2X2KEY_MAP_MIKROBUS( cfg, mikrobus ) \
52 cfg.t1o = MIKROBUS( mikrobus, MIKROBUS_AN ); \
53 cfg.t2o = MIKROBUS( mikrobus, MIKROBUS_RST ); \
54 cfg.t3o = MIKROBUS( mikrobus, MIKROBUS_CS ); \
55 cfg.t4o = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
56 cfg.tint = MIKROBUS( mikrobus, MIKROBUS_INT )
63#define C2X2KEY_RETVAL uint8_t
64
65#define C2X2KEY_OK 0x00
66#define C2X2KEY_INIT_ERROR 0xFF // End group macro
70
71// --------------------------------------------------------------- PUBLIC TYPES
80typedef struct
81{
82 // Input pins
83
84 digital_in_t t1o;
85 digital_in_t t2o;
86 digital_in_t t3o;
87 digital_in_t t4o;
88 digital_in_t tint;
89
90} c2x2key_t;
91
95typedef struct
96{
97 // Additional gpio pins
98
99 pin_name_t t1o;
100 pin_name_t t2o;
101 pin_name_t t3o;
102 pin_name_t t4o;
103 pin_name_t tint;
104
106 // End types group
108
109// ------------------------------------------------------------------ CONSTANTS // End constants group
117
118// ------------------------------------------------------------------ VARIABLES // End variable group
126
127// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
128
134#ifdef __cplusplus
135extern "C"{
136#endif
137
147
156
165
178
191
204
217
230
231#ifdef __cplusplus
232}
233#endif
234#endif // _C2X2KEY_H_
235 // End public_function group
238
239// ------------------------------------------------------------------------- END
#define C2X2KEY_RETVAL
Definition: c2x2key.h:63
void c2x2key_default_cfg(c2x2key_t *ctx)
Click Default Configuration function.
uint8_t c2x2key_t1_state(c2x2key_t *ctx)
Taster 1 state function.
C2X2KEY_RETVAL c2x2key_init(c2x2key_t *ctx, c2x2key_cfg_t *cfg)
Initialization function.
uint8_t c2x2key_taster_pressed(c2x2key_t *ctx)
Taster Pressed function.
uint8_t c2x2key_t2_state(c2x2key_t *ctx)
Taster 2 state function.
void c2x2key_cfg_setup(c2x2key_cfg_t *cfg)
Config Object Initialization function.
uint8_t c2x2key_t4_state(c2x2key_t *ctx)
Taster 4 state function.
uint8_t c2x2key_t3_state(c2x2key_t *ctx)
Taster 3 state function.
Click configuration structure definition.
Definition: c2x2key.h:96
pin_name_t t2o
Definition: c2x2key.h:100
pin_name_t tint
Definition: c2x2key.h:103
pin_name_t t3o
Definition: c2x2key.h:101
pin_name_t t4o
Definition: c2x2key.h:102
pin_name_t t1o
Definition: c2x2key.h:99
Click ctx object definition.
Definition: c2x2key.h:81
digital_in_t t4o
Definition: c2x2key.h:87
digital_in_t t2o
Definition: c2x2key.h:85
digital_in_t t3o
Definition: c2x2key.h:86
digital_in_t t1o
Definition: c2x2key.h:84
digital_in_t tint
Definition: c2x2key.h:88