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
57
58
61
62
65
66
69
70
73
76
77
80
83
84
87
90
91
94
95
96
97
100
101
104
107
108
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
137
141
142
147
148
149
150
151
152
158
163
164
170
175
176
179
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
218
225
226
232
243
244
250
255
256
262
266
267
273
285
286
289
290
293
294
297
298
/* ... */
/* ... */
#include "stm32446e_eval_io.h"
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
static IO_DrvTypeDef *IoDrv = NULL;
static uint8_t mfxstm32l152Identifier;
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
uint8_t BSP_IO_Init(void)
{
uint8_t ret = IO_OK;
if ( IoDrv == NULL)
{
mfxstm32l152Identifier=0;
mfxstm32l152Identifier = mfxstm32l152_io_drv.ReadID(IO_I2C_ADDRESS);
if((mfxstm32l152Identifier == MFXSTM32L152_ID_1) || (mfxstm32l152Identifier == MFXSTM32L152_ID_2))
{
IoDrv = &mfxstm32l152_io_drv;
}if ((mfxstm32l152Identifier == MFXSTM32L152_ID_1) || (mfxstm32l152Identifier == MFXSTM32L152_ID_2)) { ... }
else
{
ret = IO_ERROR;
}else { ... }
if(ret == IO_OK)
{
IoDrv->Init(IO_I2C_ADDRESS);
IoDrv->Start(IO_I2C_ADDRESS, IO_PIN_ALL);
}if (ret == IO_OK) { ... }
}if (IoDrv == NULL) { ... }
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);
}{ ... }
/* ... */
uint8_t BSP_IO_ConfigPin(uint32_t IoPin, IO_ModeTypedef IoMode)
{
IoDrv->Config(IO_I2C_ADDRESS, IoPin, IoMode);
return IO_OK;
}{ ... }
/* ... */
uint8_t BSP_IO_ConfigIrqOutPin(uint8_t IoIrqOutPinPolarity, uint8_t IoIrqOutPinType)
{
if((mfxstm32l152Identifier == MFXSTM32L152_ID_1) || (mfxstm32l152Identifier == MFXSTM32L152_ID_2))
{
mfxstm32l152_SetIrqOutPinPolarity(IO_I2C_ADDRESS, IoIrqOutPinPolarity);
mfxstm32l152_SetIrqOutPinType(IO_I2C_ADDRESS, IoIrqOutPinType);
}if ((mfxstm32l152Identifier == MFXSTM32L152_ID_1) || (mfxstm32l152Identifier == MFXSTM32L152_ID_2)) { ... }
return IO_OK;
}{ ... }
/* ... */
void BSP_IO_WritePin(uint32_t IoPin, BSP_IO_PinStateTypeDef PinState)
{
IoDrv->WritePin(IO_I2C_ADDRESS, IoPin, PinState);
}{ ... }
/* ... */
uint32_t BSP_IO_ReadPin(uint32_t IoPin)
{
return(IoDrv->ReadPin(IO_I2C_ADDRESS, IoPin));
}{ ... }
/* ... */
void BSP_IO_TogglePin(uint32_t IoPin)
{
if(IoDrv->ReadPin(IO_I2C_ADDRESS, IoPin) != 0)
{
IoDrv->WritePin(IO_I2C_ADDRESS, IoPin, 0);
...}
else
{
IoDrv->WritePin(IO_I2C_ADDRESS, IoPin, 1);
}else { ... }
}{ ... }
/* ... */
/* ... */
/* ... */
/* ... */