cancel
Showing results for 
Search instead for 
Did you mean: 

How to add my own code in usart_if.c file

pho3nix
Associate III

Hello,

I am trying to put the Lorawan keys (DEVEUI,APPEUI, APPKEY) from a serial terminal using uart communication for end node application. I am using uart interrupts for this. There is cubemx generated usart_if.c file which contains HAL_UART_RxCpltCallback() already. This is the code snippet:

 

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)

{

/* USER CODE BEGIN HAL_UART_RxCpltCallback_1 */



/* USER CODE END HAL_UART_RxCpltCallback_1 */

if (huart->Instance == USART2)

{

if ((NULL != RxCpltCallback) && (HAL_UART_ERROR_NONE == huart->ErrorCode))

{

RxCpltCallback(&charRx, 1, 0);

}

HAL_UART_Receive_IT(huart, &charRx, 1);

}

/* USER CODE BEGIN HAL_UART_RxCpltCallback_2 */



/* USER CODE END HAL_UART_RxCpltCallback_2 */

}

 

 

How to modify this with my code so that I can receive a command from serial terminal and proceed accordingly. 

Thank you.

0 REPLIES 0