You are here

How to Write Serial Communication Program Not Applicable to RTOS

1 post / 0 new
Jack_Li
Offline
Last seen: 4 years 7 months ago
Joined: 2019-07-01 05:03
Posts: 12
How to Write Serial Communication Program Not Applicable to RTOS

Hello, friends, I am a beginner, I do not understand the system, I want to control VESC through the serial port of my stm32f407 development board, but I can not understand the pointer and callback in the routine very well. Can you give me some help? How to write serial interrupt? My own is as follows.Is it true? Thank you.

 

 

void USART1_IRQHandler(void)                    //usart interrupt service function
{
    u8 Res;
    if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)  //received flag
    {
          Res =USART_ReceiveData(USART1);//   //read data from register
      switch(Res)
      {
        case 0x02:   bldc_interface_uart_process_byte(2); break;  //
        case 0x03:   bldc_interface_uart_process_byte(3); break;   //
        default: break;
      }        
  }