diff options
| author | Aditya Naik | 2020-03-25 16:55:14 -0400 |
|---|---|---|
| committer | Aditya Naik | 2020-03-25 16:55:14 -0400 |
| commit | f8cac49d3793c812226137c08153e0f8aceeed81 (patch) | |
| tree | 259fee82075fe99cd466c0a26a000b7dd0d1a59b | |
| parent | 45fd36f9217301a85b774fdb2ede7f8e29f0e3c7 (diff) | |
AF error limits
| -rw-r--r-- | Src/main.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -157,6 +157,8 @@ int main(void) uint8_t MDR_ACK_buf[8] = {0};
HAL_Delay(100);
+
+ uint32_t AF_error_counter = 0;
while (HAL_I2C_Master_Receive(&hi2c1, (uint8_t)I2C_ADDRESS, (uint8_t*)MDR_ACK_buf, s2m_MDR_req_ACK_size, 100) != HAL_OK) {
if (HAL_I2C_GetError(&hi2c1) != HAL_I2C_ERROR_AF) {
#ifdef DEBUG_ENABLE
@@ -166,6 +168,9 @@ int main(void) #endif /* DEBUG_ENABLE */
break;
}
+ if (++AF_error_counter > 1000) {
+ break;
+ }
}
#ifdef TESTING_ENABLE
|
