- //响应Idle中断回调函数,MSG_LEN为报文长度
- int pos = 0;
- void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
- {
- if (huart == &huart7)
- {
- for(int j = 0;j<=MSG_LEN;j++) //在缓存数组里循环接收报文字节
- {
- rxbuf = rxBufArr[pos];
- //开启解析流程
- }
- uart_start_receive(); //重新开启接收
- pos++;
- if(pos>=BUFARR_SIZE)
- {
- pos = 0;
- }
- }
- }
|