搜索
查看: 1854|回复: 0

[STM32L476] HAL庫 UART中斷接收問題

[复制链接]

该用户从未签到

3

主题

7

帖子

0

蝴蝶豆

高级会员

最后登录
2020-10-23
发表于 2017-7-11 15:49:21 | 显示全部楼层 |阅读模式
調回函數,這樣用,我只能收到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.write] = Uart1.Rx_buffer[0];

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

回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条

Archiver|手机版|小黑屋|论坛-意法半导体STM32/STM8技术社区

GMT+8, 2024-5-7 04:52 , Processed in 0.155763 second(s), 33 queries .

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表