/** * \brief This function will Read timer-1 and timer-2 capture values * and disable RTC * - Wait until timer1 capture interrupt flag on channel CCA is set * - Read timer-1 and timer-2 capture values and store in variables * - Disable RTC */ void rtccalib_store_capture_val(void) { /* Wait until timer1 capture interrupt flag on channel CCA is set */ do {} while ((tc45_is_cc_interrupt(&TIMER1_FOR_CALIB, TC45_CCA)) == 0); /* Read timer-1 capture values and store */ rtccalib_tim1_capture_value = tc45_read_cc(&TIMER1_FOR_CALIB, TC45_CCA); /* Read timer-2 capture values and store */ rtccalib_tim2_capture_value = tc45_read_cc(&TIMER2_FOR_CALIB, TC45_CCA); /* Disable RTC */ sysclk_rtcsrc_disable(); }
/** * \brief Timer Counter Overflow interrupt callback function * * This function is called when an overflow interrupt has occurred (50ms) on * TCD5 and change PWM duty single generation on TCD5 CCA. */ static void example_overflow_interrupt_callback(void) { tc45_write_cc(&TCD5, TC45_CCA, tc45_read_cc(&TCD5, TC45_CCA) + 0xA00); tc45_clear_overflow(&TCC4); }