1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
32
33
34
35
41
42
43
44
45
46
47
48
53
56
57
62
69
70
75
82
83
88
95
96
101
108
109
114
117
118
123
126
127
132
135
136
141
144
145
150
151
152
157
168
169
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
203
204
209
210
224
225
226
227
228
229
230
231
232
233
234
235
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
259
260
261
266
267
268
269
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
314
315
316
317
318
319
320
325
330
331
336
349
350
355
367
370
371
/* ... */
#include "stm32f4xx_it.h"
/* ... */
/* ... */
Includes
extern __IO uint8_t ubMasterRequestDirection;
extern __IO uint8_t ubMasterXferDirection;
extern __IO uint8_t ubMasterNbDataToReceive;
extern __IO uint8_t ubSlaveNbDataToTransmit;
Private variables
/* ... */
void NMI_Handler(void)
{
}{ ... }
/* ... */
void HardFault_Handler(void)
{
while (1)
{
}while (1) { ... }
}{ ... }
/* ... */
void MemManage_Handler(void)
{
while (1)
{
}while (1) { ... }
}{ ... }
/* ... */
void BusFault_Handler(void)
{
while (1)
{
}while (1) { ... }
}{ ... }
/* ... */
void UsageFault_Handler(void)
{
while (1)
{
}while (1) { ... }
}{ ... }
/* ... */
void SVC_Handler(void)
{
}{ ... }
/* ... */
void DebugMon_Handler(void)
{
}{ ... }
/* ... */
void PendSV_Handler(void)
{
}{ ... }
/* ... */
void SysTick_Handler(void)
{
}{ ... }
...
...
/* ... */
void USER_BUTTON_IRQHANDLER(void)
{
if(LL_EXTI_IsActiveFlag_0_31(USER_BUTTON_EXTI_LINE) != RESET)
{
LL_EXTI_ClearFlag_0_31(USER_BUTTON_EXTI_LINE);
UserButton_Callback();
}if (LL_EXTI_IsActiveFlag_0_31(USER_BUTTON_EXTI_LINE) != RESET) { ... }
}{ ... }
/* ... */
void I2C1_EV_IRQHandler(void)
{
if(LL_I2C_IsActiveFlag_ADDR(I2C1))
{
if(LL_I2C_GetTransferDirection(I2C1) == LL_I2C_DIRECTION_READ)
{
LL_I2C_EnableIT_BUF(I2C1);
LL_I2C_ClearFlag_ADDR(I2C1);
}if (LL_I2C_GetTransferDirection(I2C1) == LL_I2C_DIRECTION_READ) { ... }
else if(LL_I2C_GetTransferDirection(I2C1) == LL_I2C_DIRECTION_WRITE)
{
LL_I2C_EnableIT_BUF(I2C1);
LL_I2C_ClearFlag_ADDR(I2C1);
}else if (LL_I2C_GetTransferDirection(I2C1) == LL_I2C_DIRECTION_WRITE) { ... }
}if (LL_I2C_IsActiveFlag_ADDR(I2C1)) { ... }
else if(LL_I2C_IsActiveFlag_RXNE(I2C1))
{
Slave_Reception_Callback();
}else if (LL_I2C_IsActiveFlag_RXNE(I2C1)) { ... }
else if(LL_I2C_IsActiveFlag_TXE(I2C1))
{
Slave_Ready_To_Transmit_Callback();
}else if (LL_I2C_IsActiveFlag_TXE(I2C1)) { ... }
else if(LL_I2C_IsActiveFlag_BTF(I2C1))
{
if(LL_I2C_GetTransferDirection(I2C1) == LL_I2C_DIRECTION_WRITE)
{
Slave_Ready_To_Transmit_Callback();
}if (LL_I2C_GetTransferDirection(I2C1) == LL_I2C_DIRECTION_WRITE) { ... }
else
{
Slave_Reception_Callback();
}else { ... }
}else if (LL_I2C_IsActiveFlag_BTF(I2C1)) { ... }
else if(LL_I2C_IsActiveFlag_STOP(I2C1))
{
LL_I2C_ClearFlag_STOP(I2C1);
Slave_Complete_Callback();
}else if (LL_I2C_IsActiveFlag_STOP(I2C1)) { ... }
}{ ... }
/* ... */
void I2C1_ER_IRQHandler(void)
{
if((ubSlaveNbDataToTransmit == 0) && \
(LL_I2C_IsActiveFlag_AF(I2C1)) && \
(LL_I2C_GetTransferDirection(I2C1) == LL_I2C_DIRECTION_WRITE))
{
LL_I2C_ClearFlag_AF(I2C1);
Slave_Complete_Callback();
}if ((ubSlaveNbDataToTransmit == 0) && \ (LL_I2C_IsActiveFlag_AF(I2C1)) && \ (LL_I2C_GetTransferDirection(I2C1) == LL_I2C_DIRECTION_WRITE)) { ... }
else
{
Error_Callback();
}else { ... }
}{ ... }
/* ... */
void I2C3_EV_IRQHandler(void)
{
if(LL_I2C_IsActiveFlag_SB(I2C3))
{
LL_I2C_TransmitData8(I2C3, SLAVE_OWN_ADDRESS | ubMasterRequestDirection);
}if (LL_I2C_IsActiveFlag_SB(I2C3)) { ... }
else if(LL_I2C_IsActiveFlag_ADDR(I2C3))
{
if(LL_I2C_GetTransferDirection(I2C3) == LL_I2C_DIRECTION_READ)
{
ubMasterXferDirection = LL_I2C_DIRECTION_READ;
if(ubMasterNbDataToReceive == 1)
{
LL_I2C_AcknowledgeNextData(I2C3, LL_I2C_NACK);
LL_I2C_EnableDMAReq_RX(I2C3);
}if (ubMasterNbDataToReceive == 1) { ... }
else if(ubMasterNbDataToReceive == 2)
{
LL_I2C_AcknowledgeNextData(I2C3, LL_I2C_NACK);
LL_I2C_EnableBitPOS(I2C3);
}else if (ubMasterNbDataToReceive == 2) { ... }
else
{
LL_I2C_EnableLastDMA(I2C3);
LL_I2C_EnableDMAReq_RX(I2C3);
}else { ... }
}if (LL_I2C_GetTransferDirection(I2C3) == LL_I2C_DIRECTION_READ) { ... }
else
{
ubMasterXferDirection = LL_I2C_DIRECTION_WRITE;
LL_I2C_EnableDMAReq_TX(I2C3);
}else { ... }
LL_I2C_ClearFlag_ADDR(I2C3);
}else if (LL_I2C_IsActiveFlag_ADDR(I2C3)) { ... }
}{ ... }
/* ... */
void I2C3_ER_IRQHandler(void)
{
Error_Callback();
}{ ... }
/* ... */
void DMA1_Stream5_IRQHandler(void)
{
if(LL_DMA_IsActiveFlag_TC5(DMA1))
{
LL_DMA_ClearFlag_TC5(DMA1);
Transfer_Complete_Callback();
}if (LL_DMA_IsActiveFlag_TC5(DMA1)) { ... }
else if(LL_DMA_IsActiveFlag_TE5(DMA1))
{
Transfer_Error_Callback();
}else if (LL_DMA_IsActiveFlag_TE5(DMA1)) { ... }
}{ ... }
/* ... */
void DMA1_Stream2_IRQHandler(void)
{
if(LL_DMA_IsActiveFlag_TC2(DMA1))
{
LL_DMA_ClearFlag_TC2(DMA1);
Transfer_Complete_Callback();
}if (LL_DMA_IsActiveFlag_TC2(DMA1)) { ... }
else if(LL_DMA_IsActiveFlag_TE2(DMA1))
{
Transfer_Error_Callback();
}else if (LL_DMA_IsActiveFlag_TE2(DMA1)) { ... }
}{ ... }
/* ... */
/* ... */