/*
 * interrup_handlers.h
 *
 * Created: 03/03/2021 08:22:26
 *  Author: Nick-XMG
 */ 


#ifndef INTERRUPT_HANDLERS_H_
#define INTERRUPT_HANDLERS_H_

#include "atmel_start.h"



// ----------------------------------------------------------------------
// 	EtherCAT Cycle Timer - 1kHz
// ----------------------------------------------------------------------
void TC7_Handler(void)
{
	if (TC7->COUNT16.INTFLAG.bit.OVF == 0x01) {
		TC7->COUNT16.INTFLAG.bit.OVF = 0x01;
		//One_ms_cycle_callback();
		//gpio_toggle_pin_level(DEBUG_1);
		//tic_port(DEBUG_3_PORT);
		//tic_port(DEBUG_2_PORT);
		One_ms_cycle_callback();
		//toc_port(DEBUG_2_PORT);
		//Motor1.timerflags.motor_telemetry_flag = true;
		
	}
}

// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
void TC0_Handler(void)
{
	/* Capture Interrupt */
	if (TC0->COUNT32.INTFLAG.bit.MC0 == 0x01) {
		TC0->COUNT32.INTFLAG.bit.MC0 = 0x01;
		//gpio_toggle_pin_level(DEBUG_2);

	}
	/* Overflow Interrupt */
	if (TC0->COUNT32.INTFLAG.bit.OVF == 0x01) {
		TC0->COUNT32.INTFLAG.bit.OVF = 0x01;
		//Motor1.motor_status.calc_rpm = 0;
		//gpio_toggle_pin_level(DEBUG_2);

	}
}





#endif /* INTERRUPT_HANDLERS_H_ */