|
@@ -284,7 +284,7 @@ int8_t i2c_check_err(void) {
|
|
|
if ((I2C1->ISR & I2C_ISR_NACKF) != 0) {
|
|
|
/* device not present */
|
|
|
r = I2C_RET_NACK;
|
|
|
- } else {
|
|
|
+ } else if ((I2C1->ISR & (I2C_ISR_ARLO | I2C_ISR_BERR)) != 0) {
|
|
|
/* other error */
|
|
|
r = I2C_RET_ERR;
|
|
|
}
|
|
@@ -354,7 +354,7 @@ int8_t user_i2c_read(const uint8_t id, const uint8_t reg_addr, uint8_t *data, co
|
|
|
I2C1->CR2 |= ( I2C_CR2_START );
|
|
|
|
|
|
/* wait for receiving data */
|
|
|
- while ((Flag.I2C_RX_End == 0) && (Flag.I2C_RX_Err == 0)) { __WFI(); };
|
|
|
+ while ((Flag.I2C_RX_End == 0) && (Flag.I2C_RX_Err == 0)) { __NOP(); };
|
|
|
|
|
|
return r;
|
|
|
}
|