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
81
82
85
88
89
92
93
96
97
100
103
104
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
132
133
138
139
140
141
147
152
153
159
164
165
168
173
174
178
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
224
225
231
236
237
243
247
248
254
266
267
270
271
274
275
278
279
/* ... */
/* ... */
#include "stm32469i_eval_io.h"
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
static IO_DrvTypeDef *IoDrv = NULL;
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
uint8_t BSP_IO_Init(void)
{
uint8_t ret = IO_ERROR;
uint8_t mfxstm32l152_id = 0;
HAL_Delay(1);
mfxstm32l152_id = mfxstm32l152_io_drv.ReadID(IO_I2C_ADDRESS);
if((mfxstm32l152_id == MFXSTM32L152_ID_1) || (mfxstm32l152_id == MFXSTM32L152_ID_2))
{
IoDrv = &mfxstm32l152_io_drv;
ret = IO_OK;
}if ((mfxstm32l152_id == MFXSTM32L152_ID_1) || (mfxstm32l152_id == MFXSTM32L152_ID_2)) { ... }
if(ret == IO_OK)
{
IoDrv->Init(IO_I2C_ADDRESS);
IoDrv->Start(IO_I2C_ADDRESS, IO_PIN_ALL);
}if (ret == IO_OK) { ... }
return ret;
}{ ... }
/* ... */
uint8_t BSP_IO_DeInit(void)
{
IoDrv = NULL;
return IO_OK;
}{ ... }
/* ... */
uint32_t BSP_IO_ITGetStatus(uint32_t IoPin)
{
return (IoDrv->ITStatus(IO_I2C_ADDRESS, IoPin));
}{ ... }
/* ... */
void BSP_IO_ITClear(void)
{
IoDrv->ClearIT(IO_I2C_ADDRESS, MFXSTM32L152_GPIO_PINS_ALL);
}{ ... }
/* ... */
void BSP_IO_ITClearPin(uint32_t IO_Pins_To_Clear)
{
IoDrv->ClearIT(IO_I2C_ADDRESS, IO_Pins_To_Clear);
}{ ... }
/* ... */
uint8_t BSP_IO_ConfigPin(uint32_t IO_Pin, IO_ModeTypedef IO_Mode)
{
IoDrv->Config(IO_I2C_ADDRESS, IO_Pin, IO_Mode);
return IO_OK;
}{ ... }
/* ... */
void BSP_IO_WritePin(uint32_t IO_Pin, BSP_IO_PinStateTypeDef PinState)
{
IoDrv->WritePin(IO_I2C_ADDRESS, IO_Pin, PinState);
}{ ... }
/* ... */
uint32_t BSP_IO_ReadPin(uint32_t IO_Pin)
{
return(IoDrv->ReadPin(IO_I2C_ADDRESS, IO_Pin));
}{ ... }
/* ... */
void BSP_IO_TogglePin(uint32_t IO_Pin)
{
if(IoDrv->ReadPin(IO_I2C_ADDRESS, IO_Pin) != 0)
{
IoDrv->WritePin(IO_I2C_ADDRESS, IO_Pin, 0);
...}
else
{
IoDrv->WritePin(IO_I2C_ADDRESS, IO_Pin, 1);
}else { ... }
}{ ... }
/* ... */
/* ... */
/* ... */
/* ... */