1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
59
60
63
64
67
68
71
74
75
78
79
82
83
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
122
127
128
133
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
160
161
167
171
172
178
182
183
188
199
200
203
204
207
208
211
212
/* ... */
/* ... */
#include "stm324xg_eval_io.h"
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
static IO_DrvTypeDef *io_driver;
/* ... */
/* ... */
/* ... */
uint8_t BSP_IO_Init(void)
{
uint8_t ret = IO_ERROR;
if(stmpe811_io_drv.ReadID(IO_I2C_ADDRESS) == STMPE811_ID)
{
io_driver = &stmpe811_io_drv;
io_driver->Init(IO_I2C_ADDRESS);
io_driver->Start(IO_I2C_ADDRESS, IO_PIN_ALL);
ret = IO_OK;
}if (stmpe811_io_drv.ReadID(IO_I2C_ADDRESS) == STMPE811_ID) { ... }
return ret;
}{ ... }
/* ... */
uint8_t BSP_IO_ITGetStatus(uint16_t IO_Pin)
{
return (io_driver->ITStatus(IO_I2C_ADDRESS, IO_Pin));
}{ ... }
/* ... */
void BSP_IO_ITClear(uint16_t IO_Pin)
{
io_driver->ClearIT(IO_I2C_ADDRESS, IO_Pin);
}{ ... }
/* ... */
uint8_t BSP_IO_ConfigPin(uint16_t IO_Pin, IO_ModeTypedef IO_Mode)
{
io_driver->Config(IO_I2C_ADDRESS, IO_Pin, IO_Mode);
return IO_OK;
}{ ... }
/* ... */
void BSP_IO_WritePin(uint16_t IO_Pin, uint8_t PinState)
{
io_driver->WritePin(IO_I2C_ADDRESS, IO_Pin, PinState);
}{ ... }
/* ... */
uint16_t BSP_IO_ReadPin(uint16_t IO_Pin)
{
return(io_driver->ReadPin(IO_I2C_ADDRESS, IO_Pin));
}{ ... }
/* ... */
void BSP_IO_TogglePin(uint16_t IO_Pin)
{
if(io_driver->ReadPin(IO_I2C_ADDRESS, IO_Pin) == 1)
{
io_driver->WritePin(IO_I2C_ADDRESS, IO_Pin, 0);
...}
else
{
io_driver->WritePin(IO_I2C_ADDRESS, IO_Pin, 1);
}else { ... }
}{ ... }
/* ... */
/* ... */
/* ... */
/* ... */