Move main UART RX callback to main.c

This commit is contained in:
jazzpi 2022-06-23 13:05:25 +02:00
parent 839a9a930a
commit e58b9ffae0
3 changed files with 11 additions and 2 deletions

View File

@ -11,6 +11,7 @@
#include "common_defs.h" #include "common_defs.h"
#include "stm32f4xx_hal.h" #include "stm32f4xx_hal.h"
#include "stm32f4xx_hal_uart.h"
extern volatile uint16_t temperatures[N_CELLS]; 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_send_read_temps(TMP144Bus* bus);
HAL_StatusTypeDef tmp144_recv_temps(TMP144Bus* bus); HAL_StatusTypeDef tmp144_recv_temps(TMP144Bus* bus);
void tmp144_handle_rx_cplt(UART_HandleTypeDef* handle);
#endif /* INC_TMP144_H_ */ #endif /* INC_TMP144_H_ */

View File

@ -179,7 +179,7 @@ HAL_StatusTypeDef tmp144_recv_temps(TMP144Bus* bus) {
return HAL_OK; return HAL_OK;
} }
void HAL_UART_RxCpltCallback(UART_HandleTypeDef* handle) { void tmp144_handle_rx_cplt(UART_HandleTypeDef* handle) {
TMP144Bus* bus; TMP144Bus* bus;
if (handle == bus_busbar.handle) { if (handle == bus_busbar.handle) {
bus = &bus_busbar; bus = &bus_busbar;

View File

@ -24,10 +24,12 @@
#include "BQ_Abstraction_Layer.h" #include "BQ_Abstraction_Layer.h"
#include "EEPROM.h" #include "EEPROM.h"
#include "FanControl.h" #include "FanControl.h"
#include "TMP144.h"
#include "stm32f4xx_hal.h" #include "stm32f4xx_hal.h"
#include "stm32f4xx_hal_gpio.h" #include "stm32f4xx_hal_gpio.h"
#include "stm32f4xx_hal_tim.h" #include "stm32f4xx_hal_tim.h"
#include "stm32f4xx_hal_uart.h"
/* USER CODE END Includes */ /* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/ /* Private typedef -----------------------------------------------------------*/
@ -514,7 +516,11 @@ static void MX_GPIO_Init(void) {
} }
/* USER CODE BEGIN 4 */ /* 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 */ /* USER CODE END 4 */
/** /**