How to pass UART_HandleTypeDef *huart trough the funciont?
I want pass UART_HandleTypeDef *my_huart at function HAL_UART_Transmit and and mange the response with interrupt. The code is show below but doesn't work. Can you help me?
//This is myfile.c
void myfunc(UART_HandleTypeDef *my_huart)
{
char command[] = "AT\r\n";
HAL_UART_Transmit(my_huart, (uint8_t *)command, sizeof(command)-1, HAL_MAX_DELAY);
}
//In the main
myfunc(&huart1);
//out of main and not call in the main
void USART1_IRQHandler(void)
{
/* USER CODE BEGIN USART1_IRQn 0 */
/* USER CODE END USART1_IRQn 0 */
HAL_UART_IRQHandler(&huart1);
if(((USART1 -> SR) & (1<<5)) == (1<<5))
{
memset(buffer,0,sizeof(buffer));
HAL_UART_Receive(&huart1, (uint8_t *)buffer, sizeof(buffer)-1, HAL_MAX_DELAY);
HAL_UART_Transmit(&huart2, (uint8_t*)buffer, strlen(buffer) , HAL_MAX_DELAY);
USART1 -> SR &= ~(1<<5);
}
}
