tester
2.0.0.0
cmake
tester
lib_tester
include
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
88
// End group macro
91
// --------------------------------------------------------------- PUBLIC TYPES
100
typedef
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
125
typedef
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
145
}
tester_cfg_t
;
146
// End types group
148
// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
149
155
#ifdef __cplusplus
156
extern
"C"
{
157
#endif
158
167
void
tester_cfg_setup
(
tester_cfg_t
*cfg );
168
176
TESTER_RETVAL
tester_init
(
tester_t
*ctx,
tester_cfg_t
*cfg );
177
187
void
tester_set_pin_high
( digital_out_t *pin );
188
198
void
tester_set_pin_low
( digital_out_t *pin );
199
200
#ifdef __cplusplus
201
}
202
#endif
203
#endif // _TESTER_H_
204
// End public_function group
207
208
// ------------------------------------------------------------------------- END
tester_t::an
digital_out_t an
Definition:
tester.h:115
tester_init
TESTER_RETVAL tester_init(tester_t *ctx, tester_cfg_t *cfg)
Initialization function.
tester_cfg_setup
void tester_cfg_setup(tester_cfg_t *cfg)
Config Object Initialization function.
tester_t::miso
digital_out_t miso
Definition:
tester.h:107
tester_cfg_t::cs
pin_name_t cs
Definition:
tester.h:134
tester_t::rst
digital_out_t rst
Definition:
tester.h:116
tester_t::pwm
digital_out_t pwm
Definition:
tester.h:117
tester_t::cs
digital_out_t cs
Definition:
tester.h:109
tester_t::int_pin
digital_out_t int_pin
Definition:
tester.h:118
tester_cfg_t::rx_pin
pin_name_t rx_pin
Definition:
tester.h:136
tester_cfg_t::miso
pin_name_t miso
Definition:
tester.h:132
tester_cfg_t
Click configuration structure definition.
Definition:
tester.h:126
tester_cfg_t::mosi
pin_name_t mosi
Definition:
tester.h:133
tester_cfg_t::tx_pin
pin_name_t tx_pin
Definition:
tester.h:135
tester_t::mosi
digital_out_t mosi
Definition:
tester.h:108
TESTER_RETVAL
#define TESTER_RETVAL
Definition:
tester.h:84
tester_cfg_t::sck
pin_name_t sck
Definition:
tester.h:131
tester_set_pin_high
void tester_set_pin_high(digital_out_t *pin)
Set pin high function.
tester_cfg_t::scl
pin_name_t scl
Definition:
tester.h:129
tester_t::tx_pin
digital_out_t tx_pin
Definition:
tester.h:110
tester_cfg_t::pwm
pin_name_t pwm
Definition:
tester.h:142
tester_t::sck
digital_out_t sck
Definition:
tester.h:106
tester_t::rx_pin
digital_out_t rx_pin
Definition:
tester.h:111
tester_cfg_t::int_pin
pin_name_t int_pin
Definition:
tester.h:143
tester_t::scl
digital_out_t scl
Definition:
tester.h:104
tester_t::sda
digital_out_t sda
Definition:
tester.h:105
tester_cfg_t::rst
pin_name_t rst
Definition:
tester.h:141
tester_cfg_t::sda
pin_name_t sda
Definition:
tester.h:130
tester_set_pin_low
void tester_set_pin_low(digital_out_t *pin)
Set pin low function.
tester_t
Click ctx object definition.
Definition:
tester.h:101
tester_cfg_t::an
pin_name_t an
Definition:
tester.h:140
Generated by
1.8.20