SmartCar-V1/Code/isr/interrupt_handler.c

42 lines
990 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "stdio.h"
#include "stm32f10x.h"
#include "stm32f10x_tim.h"
#include "stm32f10x_usart.h"
#include "mw_soft_timer.h"
#include "mw_printf.h"
void TIM2_IRQHandler(void) //TIM3 中断
{
if(TIM_GetITStatus(TIM2, TIM_IT_Update) != RESET)
{
// 硬件置了1需要软件来清0
TIM_ClearITPendingBit(TIM2, TIM_IT_Update);
/* add your code here */
mw_soft_timer_user_systick_update();
}
}
void USART1_IRQHandler(void)
{
// uint16_t usart_tx_data;
uint8_t usart_rx_data;
if(USART_GetITStatus(USART1, USART_IT_TC) != RESET)
{
// USART_SendData(USART1, )
USART_ClearITPendingBit(USART1, USART_IT_TC); //清除标志位
}
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
{
// USART_SendData(USART1, )
USART_ClearITPendingBit(USART1, USART_IT_RXNE); //清除标志位
usart_rx_data = (uint8_t)(USART_ReceiveData(USART1));
mw_printf_insert_data(usart_rx_data);
}
}