Skip to main content
JAlle.2
Associate II
December 16, 2020
Question

Can you send a message over UART in a callback function?

  • December 16, 2020
  • 0 replies
  • 389 views

I am implementing the conversion complete callback function for the ADC and am trying to send a message over UART when this completes. However, it does not seem to want to work. I have independently verified that both the callback function is being called and the send_message function works correctly. I am using the CubeIDE to generate code for me. Take a look at the code below

void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)

{

send_message((uint8_t*)"Hello there");

}

void send_message(uint8_t* message)

{

HAL_UART_Transmit(&huart1, message, strlen((char*)message), 1000);

}

Any help is much appreciated. Thanks

This topic has been closed for replies.