File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1067,6 +1067,8 @@ void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c)
1067
1067
/* Get object ptr based on handler ptr */
1068
1068
i2c_t * obj = get_i2c_obj (hi2c );
1069
1069
struct i2c_s * obj_s = I2C_S (obj );
1070
+ uint32_t event_code = 0 ;
1071
+
1070
1072
#if DEVICE_I2CSLAVE
1071
1073
I2C_HandleTypeDef * handle = & (obj_s -> handle );
1072
1074
uint32_t address = 0 ;
@@ -1076,6 +1078,11 @@ void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c)
1076
1078
}
1077
1079
#endif
1078
1080
1081
+
1082
+ if ((handle -> ErrorCode & HAL_I2C_ERROR_AF ) == HAL_I2C_ERROR_AF ) {
1083
+ /* Keep Set event flag */
1084
+ event_code = (I2C_EVENT_TRANSFER_EARLY_NACK ) | (I2C_EVENT_ERROR_NO_SLAVE );
1085
+ }
1079
1086
DEBUG_PRINTF ("HAL_I2C_ErrorCallback:%d, index=%d\r\n" , (int ) hi2c -> ErrorCode , obj_s -> index );
1080
1087
1081
1088
/* re-init IP to try and get back in a working state */
@@ -1090,7 +1097,7 @@ void HAL_I2C_ErrorCallback(I2C_HandleTypeDef *hi2c)
1090
1097
#endif
1091
1098
1092
1099
/* Keep Set event flag */
1093
- obj_s -> event = I2C_EVENT_ERROR ;
1100
+ obj_s -> event = event_code | I2C_EVENT_ERROR ;
1094
1101
}
1095
1102
1096
1103
const PinMap * i2c_master_sda_pinmap ()
You can’t perform that action at this time.
0 commit comments