-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathI2C_ISR_Callback_STM32.c
79 lines (65 loc) · 1.23 KB
/
I2C_ISR_Callback_STM32.c
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* I2C_ISR_Callback_STM32.c
*
* Created on: Aug 8, 2024
* Author: karl.yamashita
*
*
* User can test for which I2C handle caused interrupt and call the ISR routine
*
*/
#include "main.h"
// Add extern for each I2C device instance
extern I2C_GenericDef tmp102_data_1;
/*
* Description: Callback after memory/register has been Read.
*/
void HAL_I2C_MemRxCpltCallback(I2C_HandleTypeDef *hi2c)
{
if(hi2c == tmp102_data_1.i2c_instance)
{
if(tmp102_data_1.RxISR)
{
tmp102_data_1.RxISR(&tmp102_data_1);
}
}
}
/*
* Description: Callback after memory/register has been written.
*/
void HAL_I2C_MemTxCpltCallback(I2C_HandleTypeDef *hi2c)
{
if(hi2c == tmp102_data_1.i2c_instance)
{
if(tmp102_data_1.TxISR)
{
tmp102_data_1.TxISR(&tmp102_data_1);
}
}
}
/*
* Description: Callback after Read.
*/
void HAL_I2C_MasterRxCpltCallback(I2C_HandleTypeDef *hi2c)
{
if(hi2c == tmp102_data_1.i2c_instance)
{
if(tmp102_data_1.RxISR)
{
tmp102_data_1.RxISR(&tmp102_data_1);
}
}
}
/*
* Description: Callback after Write.
*/
void HAL_I2C_MasterTxCpltCallback(I2C_HandleTypeDef *hi2c)
{
if(hi2c == tmp102_data_1.i2c_instance)
{
if(tmp102_data_1.TxISR)
{
tmp102_data_1.TxISR(&tmp102_data_1);
}
}
}