cancel
Showing results for 
Search instead for 
Did you mean: 

How to use HAL_UART_Receive_IT to stop current function and execute Callback?

JPere.2
Associate

I am using a keyboard to read several commands using HAL_UART_Recieve().

For each command I perform a different function. There are 3 such commands corresponding to one function each.

Assuming 3 functions multiply(), divide(), add() which are called if I press 'M','D','�?' respectively.

I want to use the HAL_UART_Recieve_IT() such that when I am in the multiply() function, if I randomly press the keyboard, I enter a fourth function subtract() after which I return to the main().

My Callback function includes the subtract() function:

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart){
 
subtract();
 
}

I'm not sure where to place the HAL_UART_Receive_IT() function?

0 REPLIES 0