当前位置:网站首页>[Teach you to use the serial port idle interrupt of the STM32HAL library]
[Teach you to use the serial port idle interrupt of the STM32HAL library]
2022-08-04 20:56:00 【xixiaohuanqaq】
I. Test environment
STM32H750VBTX development board
Second, Steps
1, open serial port idle interrupt
HAL_StatusTypeDef HAL_UARTEx_ReceiveToIdle_IT(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)// Open IDLE in front of the main function, this size is the size of the buffer array you set yourself, the file posted below has the definition of this function
This function is in stm32h7xx_hal_uart_ex.c, which has already opened the serial port idle interrupt. What I checked before is not correct. Only in a communication group did I know that it was so simple.
2. Use the serial port idle callback function directly
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_tspan> Size){if(huart->Instance == USART1){//Call the serial port idle callback function directly, this size is the number of bytes received by the serial port each time}HAL_UARTEx_ReceiveToIdle_IT() //Open serial port idle interrupt again}
3, HAL_UART_IRQHandler(&huart1);
void USART1_IRQHandler(void){/* USER CODE BEGIN USART1_IRQn 0 *//* USER CODE END USART1_IRQn 0 */HAL_UART_IRQHandler(&huart1);//The processing of the flag bit has helped us deal with it. We directly call the callback function, namelyCan!/* USER CODE BEGIN USART1_IRQn 1 *//* USER CODE END USART1_IRQn 1 */}
III. Summary
**Using the serial port idle interrupt through the HAL library is so simple. I have checked a lot of information before, but they are not using the HAL library. They are all rewritten.Stuff, it's a lot easier to actually use the HAL library.At present, only the serial port idle interrupt is used, and the update will continue after the subsequent use of DMA.Thank you to the big guys in the group who have carefully guided and answered questions!!!**
边栏推荐
猜你喜欢
[TypeScript] In-depth study of TypeScript enumeration
ASP.NET商贸进销存管理系统源码(带数据库文档)源码免费分享
linkboy 5.0 正式发布,新增语音识别、图像识别
Tear down the underlying mechanism of the five JOINs of SparkSQL
Five Minutes Introductory Text Processing Three Musketeers grep awk sed
Qt Designer生成的图形可以自适应窗口的大小变化
mdk5.14无法烧录
手撕SparkSQL五大JOIN的底层机制
数字IC设计中基本运算的粗略的延时估计
Zero-knowledge proof - zkSNARK proof system
随机推荐
常用正则表达式[通俗易懂]
Web3时代的战争
【2022杭电多校5 1003 Slipper】多个超级源点+最短路
明明加了唯一索引,为什么还是产生了重复数据?
如何找到某个 ABAP structure 某字段的源头来自哪个数据库表
面试官:Redis中过期的key是怎么被删除的?
Matlab画图2
腾讯云胡启明:Kubernetes云上资源的分析与优化
Oreo domain name authorization verification system v1.0.6 public open source version website source code
idea2021版本添加上一步和下一步操作到工具栏
How to make good use of builder mode
多商户商城系统功能拆解22讲-平台端分销商品
链栈的应用
手撕SparkSQL五大JOIN的底层机制
Win10 uwp use ScaleTransform magnify an element
Zero-knowledge proof notes - private transaction, pederson, interval proof, proof of ownership
win10 uwp 使用 WinDbg 调试
vs Code 运行一个本地WEB服务器
vehemently condemn
三种方式设置特定设备UWP XAML view