Пример #1
0
/*! \brief  read the actual timer count from register
 */
uint16_t tmr_read_count(void)
{
    return tc_read_cv(TIMER, TIMER_CHANNEL_ID);
}
Пример #2
0
void delay(uint32_t us)		/* A simple implementation for a delay in us (not calibrated) */
{
	tc_start(TC1,1);
	while (tc_read_cv(TC1,1) < us*42);
	tc_stop(TC1,1);
}
 /**************************************************************************
 The interrupt service routine.
 Reads the timer counter every time the ISR fires. Resets/restarts the clock
 and maintains a counter.
 **************************************************************************/
 void pin_edge_handler()
 {
	 timerRightWheel = tc_read_cv(TC2, 1);
	 tc_start(TC2, 1);
	 counterRightWheel++;
 }
Пример #4
0
void delayMicroseconds(uint32_t us)		/* A simple implementation for a delay in us (not calibrated) */
{
	tc_start(TC0,0);
	while (tc_read_cv(TC0,0) < us*42);
	tc_stop(TC0,0);
}