基于STM32F103C8T6与NRF24C01控制的四轴飞行器
#include "stm32f10x.h"
#include "delay.h"
#include "stdio.h"
#include "led.h"
#include "si24r1.h"
#include "ANO_DT.h"
#include "remotedata.h"
#include "structconfig.h"
uint8_t LED_Scan = 0;
uint8_t IMU_Scan = 0;
uint8_t MPU_Scan = 0;
uint8_t IRQ_Scan = 0;
uint8_t Batt_Scan = 0;
uint8_t ANO_Scan = 0;
oid USART1_IRQHandler(void)
{
uint8_t clear = clear; //定义这个变量是针对编译出现“没有用到这个变量”的警告提示
uint8_t res;
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET) //接收中断
{
res = USART1->DR;
ANO_DT_Data_Receive_Prepare(res); //上位机数据接收与解析
}else if(USART_GetITStatus(USART1, USART_IT_IDLE) != RESET) //空闲中断
{
clear = USART1->SR; //读SR寄存器
clear = USART1->DR; //读DR寄存器(先读SR,再度DR,就是为了清除IDIE中断)
}
USART_ClearITPendingBit(USART1,USART_IT_RXNE);
}
|