tilt4 2.1.0.0
tilt4.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2020 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
28#ifndef TILT4_H
29#define TILT4_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
35#include "drv_digital_out.h"
36#include "drv_digital_in.h"
37
53#define TILT4_PIN_STATE_HIGH 0x01
54#define TILT4_PIN_STATE_LOW 0x00
55
60#define TILT4_SWITCH_OFF 0x00
61#define TILT4_SWITCH_ON 0x01
62 // tilt4_set
64
79#define TILT4_MAP_MIKROBUS( cfg, mikrobus ) \
80 cfg.led = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
81 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
82 // tilt4_map // tilt4
85
90typedef struct
91{
92 digital_out_t led;
94 digital_in_t int_pin;
96} tilt4_t;
97
102typedef struct
103{
104 pin_name_t led;
105 pin_name_t int_pin;
108
113typedef enum
114{
116 TILT4_ERROR = -1
117
119
136
150err_t tilt4_init ( tilt4_t *ctx, tilt4_cfg_t *cfg );
151
163
174void tilt4_set_led_state ( tilt4_t *ctx, uint8_t pin_state );
175
176#ifdef __cplusplus
177}
178#endif
179#endif // TILT4_H
180 // tilt4
182
183// ------------------------------------------------------------------------ END
err_t tilt4_init(tilt4_t *ctx, tilt4_cfg_t *cfg)
Tilt 4 initialization function.
void tilt4_set_led_state(tilt4_t *ctx, uint8_t pin_state)
Tilt 4 LED pin setting function.
void tilt4_cfg_setup(tilt4_cfg_t *cfg)
Tilt 4 configuration object setup function.
uint8_t tilt4_read_int_state(tilt4_t *ctx)
Tilt 4 Interrupt pin reading function.
Tilt 4 Click configuration object.
Definition: tilt4.h:103
pin_name_t led
Definition: tilt4.h:104
pin_name_t int_pin
Definition: tilt4.h:105
Tilt 4 Click context object.
Definition: tilt4.h:91
digital_out_t led
Definition: tilt4.h:92
digital_in_t int_pin
Definition: tilt4.h:94
tilt4_return_value_t
Tilt 4 Click return value data.
Definition: tilt4.h:114
@ TILT4_ERROR
Definition: tilt4.h:116
@ TILT4_OK
Definition: tilt4.h:115