terminal2 2.0.0.0
terminal2.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 TERMINAL2_H
29#define TERMINAL2_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
39#ifdef PREINIT_SUPPORTED
40#include "preinit.h"
41#endif
42
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
45 #include "delays.h"
46 #endif
47#endif
48
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51
72#define TERMINAL2_MAP_MIKROBUS( cfg, mikrobus ) \
73 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
74 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
75 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
76 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
77 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT ); \
78 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
79 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
80 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
81 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
82 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
83 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
84 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_TX )
85
86 // terminal2_map
87 // terminal2
88
93typedef struct
94{
95 digital_out_t scl;
96 digital_out_t sda;
97 digital_out_t sck;
98 digital_out_t miso;
99 digital_out_t mosi;
100 digital_out_t cs;
101 digital_out_t tx_pin;
102 digital_out_t rx_pin;
103 digital_out_t an;
104 digital_out_t rst;
105 digital_out_t pwm;
106 digital_out_t int_pin;
107
109
114typedef struct
115{
116 pin_name_t scl;
117 pin_name_t sda;
118 pin_name_t sck;
119 pin_name_t miso;
120 pin_name_t mosi;
121 pin_name_t cs;
122 pin_name_t tx_pin;
123 pin_name_t rx_pin;
124 pin_name_t an;
125 pin_name_t rst;
126 pin_name_t pwm;
127 pin_name_t int_pin;
128
130
141
158
173
181void terminal2_set_pin_high ( digital_out_t *pin );
182
190void terminal2_set_pin_low ( digital_out_t *pin );
191
199void terminal2_toggle_pin ( digital_out_t *pin );
200
209
218
227
228#ifdef __cplusplus
229}
230#endif
231#endif // TERMINAL2_H
232
233 // terminal2
234
235// ------------------------------------------------------------------------ END
void terminal2_cfg_setup(terminal2_cfg_t *cfg)
Terminal 2 configuration object setup function.
void terminal2_set_all_pins_low(terminal2_t *ctx)
Terminal 2 set all pins low function.
err_t terminal2_init(terminal2_t *ctx, terminal2_cfg_t *cfg)
Terminal 2 initialization function.
void terminal2_toggle_pin(digital_out_t *pin)
Terminal 2 toggle pin function.
void terminal2_set_pin_low(digital_out_t *pin)
Terminal 2 set pin low function.
void terminal2_set_all_pins_high(terminal2_t *ctx)
Terminal 2 set all pins high function.
void terminal2_set_pin_high(digital_out_t *pin)
Terminal 2 set pin high function.
void terminal2_toggle_all_pins(terminal2_t *ctx)
Terminal 2 toggle all pins function.
Terminal 2 Click configuration object.
Definition terminal2.h:115
pin_name_t sck
Definition terminal2.h:118
pin_name_t tx_pin
Definition terminal2.h:122
pin_name_t mosi
Definition terminal2.h:120
pin_name_t rx_pin
Definition terminal2.h:123
pin_name_t scl
Definition terminal2.h:116
pin_name_t int_pin
Definition terminal2.h:127
pin_name_t pwm
Definition terminal2.h:126
pin_name_t miso
Definition terminal2.h:119
pin_name_t sda
Definition terminal2.h:117
pin_name_t rst
Definition terminal2.h:125
pin_name_t an
Definition terminal2.h:124
pin_name_t cs
Definition terminal2.h:121
Terminal 2 Click context object.
Definition terminal2.h:94
digital_out_t cs
Definition terminal2.h:100
digital_out_t sck
Definition terminal2.h:97
digital_out_t mosi
Definition terminal2.h:99
digital_out_t pwm
Definition terminal2.h:105
digital_out_t sda
Definition terminal2.h:96
digital_out_t int_pin
Definition terminal2.h:106
digital_out_t rst
Definition terminal2.h:104
digital_out_t rx_pin
Definition terminal2.h:102
digital_out_t scl
Definition terminal2.h:95
digital_out_t tx_pin
Definition terminal2.h:101
digital_out_t miso
Definition terminal2.h:98
digital_out_t an
Definition terminal2.h:103
terminal2_return_value_t
Terminal 2 Click return value data.
Definition terminal2.h:136
@ TERMINAL2_OK
Definition terminal2.h:137
@ TERMINAL2_ERROR
Definition terminal2.h:138