当前位置:网站首页>[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 functionThis 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!!!**边栏推荐
- Chrome安装zotero connector 插件
- web漏洞扫描器-awvs
- KubeSphere简介,功能介绍,优势,架构说明及应用场景
- Comic | Two weeks after the boss laid me off, he hired me back and doubled my salary!
- C语言——青蛙跳台阶(递归)
- C语言小笔记+题
- 后缀式的计算
- [21天学习挑战赛——内核笔记](二)——设备树基础
- 【TypeScript】深入学习TypeScript枚举
- After encountering MapStruct, the conversion between PO, DTO and VO objects is no longer handwritten
猜你喜欢

3. Byte stream and character stream of IO stream

SAP ABAP OData 服务如何支持 $select 有选择性地仅读取部分模型字段值试读版

C#移动OA办公系统源码(基于微信企业号)

【CAS:2306109-91-9 |胺-PEG4-脱硫生物素】价格

Zero-knowledge proof notes - private transaction, pederson, interval proof, proof of ownership

Uniapp微信雪糕刺客单页小程序源码

【2022杭电多校5 1003 Slipper】多个超级源点+最短路

MATLAB中readtimetable函数用法

数字IC设计中基本运算的粗略的延时估计

搭建MyCat2一主一从的MySQL读写分离
随机推荐
【debug】postgres数据存储错乱
搭建MyCat2双主双从的MySQL读写分离
如何最简单、通俗地理解爬虫的Scrapy框架?
括号匹配
Retrofit的使用及原理详解
vscode离线安装插件方法
js的new Function()常用方法
构建Buildroot根文件系统(I.MX6ULL)
五分钟入门文本处理三剑客grep awk sed
[Data Mining] Written Exam Questions for Sohu Data Mining Engineers
【2022牛客多校5 A题 Don‘t Starve】DP
常用正则表达式[通俗易懂]
[21天学习挑战赛——内核笔记](二)——设备树基础
新式茶饮,卷完水果还能卷什么?
adb控制常用命令
win10 uwp modify picture quality compress picture
How to make good use of builder mode
二叉搜索树解决硬木问题
面试官:Redis中过期的key是怎么被删除的?
WIN10系统如何开启终端