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
72
75
76
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
102
103
108
109
110
111
117
122
123
126
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
152
153
159
164
165
171
175
176
181
193
194
197
198
201
202
205
206
/* ... */
/* ... */
#include "stm324x9i_eval_io.h"
/* ... */
/* ... */
/* ... */
/* ... */
static IO_DrvTypeDef *io_driver;
/* ... */
/* ... */
/* ... */
uint8_t BSP_IO_Init(void)
{
uint8_t ret = IO_ERROR;
if(stmpe1600_io_drv.ReadID(IO_I2C_ADDRESS) == STMPE1600_ID)
{
io_driver = &stmpe1600_io_drv;
ret = IO_OK;
}if (stmpe1600_io_drv.ReadID(IO_I2C_ADDRESS) == STMPE1600_ID) { ... }
if(ret == IO_OK)
{
io_driver->Init(IO_I2C_ADDRESS);
io_driver->Start(IO_I2C_ADDRESS, IO_PIN_ALL);
}if (ret == IO_OK) { ... }
return ret;
}{ ... }
/* ... */
uint8_t BSP_IO_ITGetStatus(uint16_t IO_Pin)
{
return (io_driver->ITStatus(IO_I2C_ADDRESS, IO_Pin));
}{ ... }
/* ... */
void BSP_IO_ITClear(void)
{
io_driver->ClearIT(IO_I2C_ADDRESS, STMPE1600_PIN_ALL);
}{ ... }
/* ... */
uint8_t BSP_IO_ConfigPin(uint16_t IO_Pin, IO_ModeTypedef IO_Mode)
{
io_driver->Config(IO_I2C_ADDRESS, (uint16_t )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 { ... }
}{ ... }
/* ... */
/* ... */
/* ... */
/* ... */