Exemple #1
0
void delay_init(void)		/* Initializes the timer used for delays */
{
	pmc_enable_periph_clk(ID_TC4);
	tc_init(TC1,1,0);		 /* TC1, channel 1, TCLK1 och capturemode */
	tc_set_block_mode(TC1,0);
	tc_stop(TC1,1);			/* making sure the timer does not run  */
}
int delayInit(void)		/* Initializes the timer used for delays */
{
	pmc_enable_periph_clk(ID_TC0);	/* power on the peripheral clock for timers */
	tc_init(TC0,0,0);				/* TC0, channel 0, TCLK1 och capturemode */
	tc_set_block_mode(TC0,0);
	tc_stop(TC0,0);					/* making sure the timer does not run  */
	return 0;						/* evertyhing is ok, typical response */
}
 /**************************************************************************
 Initialize the timer counter.
 **************************************************************************/
 void configure_tc_RightWheel(void)
 {
	 pmc_set_writeprotect(false);
	 pmc_enable_periph_clk(ID_TC7);
	 tc_init(TC2,1,TC_CMR_TCCLKS_TIMER_CLOCK3);		 /* TC2, channel 1, TCLK3 and capturemode */
	 tc_set_block_mode(TC2,1);
	 
	 
 }