/***********************************************************************
 * Copyright (c)  2017 - 2022, Unicmicro Co.,Ltd .
 * All rights reserved.
 * Filename    : atimer_xorinput.c
 * Description : atimer_xorinput source file
 * Author(s)   : Hackett
 * version     : V1.0
 * Modify date : 2022-07-10
 ***********************************************************************/
#include  "atim_xorinput.h"
#include  "uart0.h"
#include  "uart1.h"
#include  "uart2.h"
#include  "atimer.h"
#include  "gpio.h"

/************************************************************************
 * function   : atimer_xorinput_pro
 * Description: atimer_xorinput_pro atimer处理回调函数
 * input : none
 * return: none
 ************************************************************************/
void atimer_xorinput_pro(void)
{		
	if(atimer_get_status(ATIM_STATUS_CC1IF))
	{	
		printfS("REG_ATIM_CCR1 : %d \r\n", atimer_get_capture(ATIM_CHANNEL1));		
	}		
	
}


/************************************************************************
 * function   : atimer_xorinput_test
 * Description: 异或输入
 * input : none
 * return: none
 ************************************************************************/
void atimer_xorinput_test(void)
{
	printfS("start atimer xorinput test! \r\n");
	
	gpio_init(GPIOF, PIN0, 7);		//PF0 ATIM_CH1
	gpio_init(GPIOF, PIN2, 10);		//PF2 ATIM_CH2
	gpio_init(GPIOG, PIN4, 11);		//PG4 ATIM_CH3	
	atimer_module_enable();			//使能时钟并复位定时器0模块
	atimer_xorinput_init(4800, 2);
	atimer_counter(ATIM_ENABLE);		//计数器使能
	atimer_irq(ATIM_CC1IE, ATIMER_IRQn, ATIM_ENABLE, atimer_xorinput_pro);//允许捕捉/比较1中断,开启中断
	
}



