summaryrefslogtreecommitdiff
path: root/Src
diff options
context:
space:
mode:
authorAditya Naik2020-04-03 19:22:29 -0400
committerAditya Naik2020-04-03 19:22:29 -0400
commita3e8a8f40f8516b7d304840e7df980f7af6ac891 (patch)
tree53cee8522170eeb3c63ca5fffd54d47be6017da5 /Src
parentbf4fadd261d45c3389d689d62730175e5357ff90 (diff)
MDR received without errors
Diffstat (limited to 'Src')
-rw-r--r--Src/main-hs.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/Src/main-hs.c b/Src/main-hs.c
index 0fe8783..3350135 100644
--- a/Src/main-hs.c
+++ b/Src/main-hs.c
@@ -259,11 +259,6 @@ int main(void)
(uint8_t*)MDR_buf, MDR_len, 1000) != HAL_OK) {
if (HAL_I2C_GetError(&hi2c1) != HAL_I2C_ERROR_AF) {
hs_sts = HS_FAILED;
- }
- else if (++AF_error_counter > 1500) {
- hs_sts = HS_FAILED;
- }
- if (hs_sts == HS_FAILED) {
#ifdef DEBUG_ENABLE
goto __HS_MDR_I2C_ERROR;
__HS_MDR_I2C_ERROR_END:
@@ -271,17 +266,19 @@ int main(void)
#endif
break;
}
+ else if (++AF_error_counter > 1500) {
+ hs_sts = HS_FAILED;
+ break;
+ }
}
- /* if (hs_sts != HS_FAILED) { */
- // TODO Decode the MDR
+ if (hs_sts != HS_FAILED) {
#ifdef TESTING_ENABLE
goto __HS_MDR_MDR_TESTING;
__HS_MDR_MDR_TESTING_END:
__asm__("nop");
#endif
- /* } */
-
-
+
+ }
break;
}
}
@@ -326,7 +323,7 @@ int main(void)
for (int x=0; x<MDR_len; x++) {
sprintf((char*)debug_buf+x, "%x", MDR_buf[x]);
}
- uint8_t mdrbuf[] = "Got MDR: \n";
+ uint8_t mdrbuf[] = "Got MDR: ";
HAL_UART_Transmit(&huart1, mdrbuf, sizeof(mdrbuf), 100);
HAL_UART_Transmit(&huart1, debug_buf, sizeof(debug_buf), 100);
HAL_UART_Transmit(&huart1, term, 2, 100);