tester 2.0.0.0
tester.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 TESTER_H
36#define TESTER_H
37
42#ifdef PREINIT_SUPPORTED
43#include "preinit.h"
44#endif
45
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
48 #include "delays.h"
49 #endif
50#endif
51
52#include "drv_digital_out.h"
53
54// -------------------------------------------------------------- PUBLIC MACROS
64#define TESTER_MAP_MIKROBUS( cfg, mikrobus ) \
65 cfg.an = MIKROBUS( mikrobus, MIKROBUS_AN ); \
66 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
67 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
68 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
69 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT ); \
70 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
71 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
72 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
73 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
74 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
75 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
76 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_TX )
77
84#define TESTER_RETVAL uint8_t
85
86#define TESTER_OK 0x00
87#define TESTER_INIT_ERROR 0xFF
90 // End group macro
91// --------------------------------------------------------------- PUBLIC TYPES
100typedef struct
101{
102 // Communication pins
103
104 digital_out_t scl;
105 digital_out_t sda;
106 digital_out_t sck;
107 digital_out_t miso;
108 digital_out_t mosi;
109 digital_out_t cs;
110 digital_out_t tx_pin;
111 digital_out_t rx_pin;
112
113 // Gpio pins
114
115 digital_out_t an;
116 digital_out_t rst;
117 digital_out_t pwm;
118 digital_out_t int_pin;
119
120} tester_t;
121
125typedef struct
126{
127 // Communication pins
128
129 pin_name_t scl;
130 pin_name_t sda;
131 pin_name_t sck;
132 pin_name_t miso;
133 pin_name_t mosi;
134 pin_name_t cs;
135 pin_name_t tx_pin;
136 pin_name_t rx_pin;
137
138 // Gpio pins
139
140 pin_name_t an;
141 pin_name_t rst;
142 pin_name_t pwm;
143 pin_name_t int_pin;
144
146
147 // End types group
148// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
149
155#ifdef __cplusplus
156extern "C"{
157#endif
158
168
177
187void tester_set_pin_high ( digital_out_t *pin );
188
198void tester_set_pin_low ( digital_out_t *pin );
199
200#ifdef __cplusplus
201}
202#endif
203#endif // _TESTER_H_
204
205 // End public_function group
207
208// ------------------------------------------------------------------------- END
#define TESTER_RETVAL
Definition tester.h:84
TESTER_RETVAL tester_init(tester_t *ctx, tester_cfg_t *cfg)
Initialization function.
void tester_set_pin_high(digital_out_t *pin)
Set pin high function.
void tester_set_pin_low(digital_out_t *pin)
Set pin low function.
void tester_cfg_setup(tester_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition tester.h:126
pin_name_t sck
Definition tester.h:131
pin_name_t tx_pin
Definition tester.h:135
pin_name_t mosi
Definition tester.h:133
pin_name_t rx_pin
Definition tester.h:136
pin_name_t scl
Definition tester.h:129
pin_name_t int_pin
Definition tester.h:143
pin_name_t pwm
Definition tester.h:142
pin_name_t miso
Definition tester.h:132
pin_name_t sda
Definition tester.h:130
pin_name_t rst
Definition tester.h:141
pin_name_t an
Definition tester.h:140
pin_name_t cs
Definition tester.h:134
Click ctx object definition.
Definition tester.h:101
digital_out_t cs
Definition tester.h:109
digital_out_t sck
Definition tester.h:106
digital_out_t mosi
Definition tester.h:108
digital_out_t pwm
Definition tester.h:117
digital_out_t sda
Definition tester.h:105
digital_out_t int_pin
Definition tester.h:118
digital_out_t rst
Definition tester.h:116
digital_out_t rx_pin
Definition tester.h:111
digital_out_t scl
Definition tester.h:104
digital_out_t tx_pin
Definition tester.h:110
digital_out_t miso
Definition tester.h:107
digital_out_t an
Definition tester.h:115