From e58b9ffae033017e1ce6e98eb6fb2d29b5a1cd5c Mon Sep 17 00:00:00 2001 From: jazzpi Date: Thu, 23 Jun 2022 13:05:25 +0200 Subject: [PATCH] Move main UART RX callback to main.c --- Core/Inc/TMP144.h | 3 +++ Core/Src/TMP144.c | 2 +- Core/Src/main.c | 8 +++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Core/Inc/TMP144.h b/Core/Inc/TMP144.h index f08c67c..9aef998 100644 --- a/Core/Inc/TMP144.h +++ b/Core/Inc/TMP144.h @@ -11,6 +11,7 @@ #include "common_defs.h" #include "stm32f4xx_hal.h" +#include "stm32f4xx_hal_uart.h" extern volatile uint16_t temperatures[N_CELLS]; @@ -42,4 +43,6 @@ HAL_StatusTypeDef tmp144_read_temps(); HAL_StatusTypeDef tmp144_send_read_temps(TMP144Bus* bus); HAL_StatusTypeDef tmp144_recv_temps(TMP144Bus* bus); +void tmp144_handle_rx_cplt(UART_HandleTypeDef* handle); + #endif /* INC_TMP144_H_ */ diff --git a/Core/Src/TMP144.c b/Core/Src/TMP144.c index 92635a5..98afde3 100644 --- a/Core/Src/TMP144.c +++ b/Core/Src/TMP144.c @@ -179,7 +179,7 @@ HAL_StatusTypeDef tmp144_recv_temps(TMP144Bus* bus) { return HAL_OK; } -void HAL_UART_RxCpltCallback(UART_HandleTypeDef* handle) { +void tmp144_handle_rx_cplt(UART_HandleTypeDef* handle) { TMP144Bus* bus; if (handle == bus_busbar.handle) { bus = &bus_busbar; diff --git a/Core/Src/main.c b/Core/Src/main.c index 1fb1fd4..16cdcbe 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -24,10 +24,12 @@ #include "BQ_Abstraction_Layer.h" #include "EEPROM.h" #include "FanControl.h" +#include "TMP144.h" #include "stm32f4xx_hal.h" #include "stm32f4xx_hal_gpio.h" #include "stm32f4xx_hal_tim.h" +#include "stm32f4xx_hal_uart.h" /* USER CODE END Includes */ /* Private typedef -----------------------------------------------------------*/ @@ -514,7 +516,11 @@ static void MX_GPIO_Init(void) { } /* USER CODE BEGIN 4 */ - +void HAL_UART_RxCpltCallback(UART_HandleTypeDef* handle) { + if (handle == &huart1 || handle == &huart3) { + tmp144_handle_rx_cplt(handle); + } +} /* USER CODE END 4 */ /**