天天地天天 发表于 2017-7-11 15:49:21

HAL庫 UART中斷接收問題

調回函數,這樣用,我只能收到1次字串後我就再也收不到下次字串了,請問這會是什麼原因呢?找了好幾天就是沒找到原因....

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
/* Prevent unused argument(s) compilation warning */
//UNUSED(huart);

/* NOTE : This function should not be modified, when the callback is needed,
            the HAL_UART_RxCpltCallback can be implemented in the user file.
   */
        if(huart->Instance == USART1)
        {
                Uart1.write = (++Uart1.write == uart1_buffer_size) ? 0 : Uart1.write;
                Uart1.buffer = Uart1.Rx_buffer;

                HAL_UART_Receive_IT(&huart1,(uint8_t*)Uart1.Rx_buffer,1);
        }
}

页: [1]
查看完整版本: HAL庫 UART中斷接收問題