高级会员

- 积分
- 665
- 金钱
- 665
- 注册时间
- 2019-7-28
- 在线时间
- 60 小时
|

楼主 |
发表于 2021-6-29 11:05:00
|
显示全部楼层
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
if(huart ->Instance == USART2) // U2 传感器
{
if( uart2_buf[1] == 0x52)
{
wz=(((int16_t)uart2_buf[7])<<8 | uart2_buf[6])*125/4096;
if(wz > 1000)
{
wz = wz-2000;
}
pulseedge3=pulseedge-(int32_t)gainwz*wz;
U2_Recv = 1 ; // U1转发标志
}
else
{
HAL_UART_Transmit(&huart2, hello, sizeof(hello),0XFF);
};
HAL_UART_Receive_IT(&huart2, uart2_buf, sizeof(uart2_buf));
}
else if(huart->Instance==USART1)
{
HAL_UART_Receive_IT(&huart1, uart1_buf, len1);
}
} |
|