#include "Include.h"

void bsp_TIMER0_Init(void)
{	  return;
	TIM0_TSCR1_TSWAI = 1; //timer 0 在MCU等待模式下不能运行
	TIM0_TSCR1_TSFRZ = 1;   //timer 0 计数器在冻结模式下禁止运行
	TIM0_TSCR1_TFFCA = 0;  //正常清除标志位
	TIM0_TSCR1_PRNT  = 0;  //
	TIM0_TSCR2_PR    = 0;  //Bus Clock / 4
	TIM0_TSCR2_TCRE  = 0;
	TIM0_TTOV        = 0;

	TIM0_TCTL1 = 0;        //禁止输出比较功能
	TIM0_TCTL2 = 0;
	TIM0_TCTL3 = 0;        //禁止输入捕获
	TIM0_TCTL4 = 0;	

	TIM0_TFLG2_TOF   = 1;
	TIM0_TSCR1_TEN   = 0;   //使能timer 0 正常功能
	TIM0_TSCR2_TOI   = 0;   //溢出中断使能

	/////////////////////
	
	//通道引脚映射  //PR0
	

	
}
void bsp_TIMER1_Init(void)
{
return;
	TIM1_TSCR1_TSWAI = 1; //timer 0 在MCU等待模式下不能运行
	TIM1_TSCR1_TSFRZ = 1;   //timer 0 计数器在冻结模式下禁止运行
	TIM1_TSCR1_TFFCA = 0;  //正常清除标志位
	TIM1_TSCR1_PRNT  = 0;  //
	TIM1_TSCR2_PR    = 0;  //Bus Clock / 4
	TIM1_TSCR2_TCRE  = 0;
	TIM1_TTOV        = 0;

	TIM1_TCTL1 = 0;        //禁止输出比较功能
	TIM1_TCTL2 = 0;
	TIM1_TCTL3 = 0;        //禁止输入捕获
	TIM1_TCTL4 = 0;	

	TIM1_TFLG2_TOF   = 1;
	TIM1_TSCR1_TEN   = 0;   //使能timer 0 正常功能
	TIM1_TSCR2_TOI   = 0;   //溢出中断使能




}
void bsp_TIMER_Stop(void)
{
    TIM0_TSCR1_TEN   = 0;
    TIM1_TSCR1_TEN   = 0;  

}

#pragma CODE_SEG __NEAR_SEG NON_BANKED //置中断函数放在FLASH的非分页区
interrupt void TIM0_Channel0_isr(void)
{
	TIM0_TFLG1_C0F = ClearFlag;
}
interrupt void TIM0_Channel1_isr(void)
{
	TIM0_TFLG1_C1F = ClearFlag;
}
interrupt void TIM0_Channel2_isr(void)
{
	TIM0_TFLG1_C2F = ClearFlag;
}
interrupt void TIM0_Channel3_isr(void)
{
	TIM0_TFLG1_C3F = ClearFlag;
}
interrupt void TIM0_Channel4_isr(void)
{
	TIM0_TFLG1_C4F = ClearFlag;
}
interrupt void TIM0_Channel5_isr(void)
{
	TIM0_TFLG1_C5F = ClearFlag;
}
interrupt void TIM0_Channel6_isr(void)
{
       //Frequency_Input_Vehicle_Speed_Capture_ISR(TIM0_TC6);   
	TIM0_TFLG1_C6F = ClearFlag;
}
interrupt void TIM0_Channel7_isr(void)
{
	TIM0_TFLG1_C7F = ClearFlag;
}
interrupt void TIM0_OverFlow_isr(void)
{
//Frequency_Input_Vehicle_Speed_Overflow_ISR();
     //CAN_Tx_Service();   
    TIM0_TFLG2_TOF = ClearFlag;
}
   ///////////////////////////////////////////////////////////////////////
interrupt void TIM1_Channel0_isr(void)
{
	TIM1_TFLG1_C0F = ClearFlag;
}
interrupt void TIM1_Channel1_isr(void)
{
	TIM1_TFLG1_C1F = ClearFlag;
}
interrupt void TIM1_Channel2_isr(void)
{
	TIM1_TFLG1_C2F = ClearFlag;
}
interrupt void TIM1_Channel3_isr(void)
{
	TIM1_TFLG1_C3F = ClearFlag;
}
interrupt void TIM1_Channel4_isr(void)
{
	TIM1_TFLG1_C4F = ClearFlag;
}
interrupt void TIM1_Channel5_isr(void)
{
	TIM1_TFLG1_C5F = ClearFlag;
}
interrupt void TIM1_Channel6_isr(void)
{
	TIM1_TFLG1_C6F = ClearFlag;
}

interrupt void TIM1_Channel7_isr(void)
{
	TIM1_TFLG1_C7F = ClearFlag;
}
interrupt void TIM1_OverFlow_isr(void)
{
    TIM1_TFLG2_TOF = ClearFlag;    
}


#pragma CODE_SEG DEFAULT