/** * Function initializing the Timestamp IRQ to get synchronized * as required for ranging. */ void rtb_tstamp_irq_init(void) { pal_trx_irq_dis(); pal_trx_reg_read(RG_IRQ_STATUS); pal_trx_bit_write(SR_ARET_TX_TS_EN, 0x01); pal_trx_bit_write(SR_IRQ_2_EXT_EN, 0x01); //Enable Timestamping over DIG2 on the at86rf233 PORTC.INTFLAGS = PORT_INT1IF_bm; TCC1_CTRLB &= ~TC1_CCAEN_bm; TIMER_SRC_DURING_TRX_AWAKE(); PORTC.INT1MASK = PIN1_bm; //DIG2 over PortC 1 /* Reset register, until time out is triggered is 65535 ms */ TCC1_CNT = 0; PORTC.PIN1CTRL = PORT_ISC1_bm; TCC1_INTFLAGS = TC1_CCAIF_bm; TCC1_INTCTRLB = TC_CCAINTLVL_HI_gc; TCC1_CTRLB |= TC1_CCAEN_bm; }
/** * @brief Selects timer clock source * * This function selects the clock source of the timer. * * @param source * - @ref TMR_CLK_SRC_DURING_TRX_SLEEP if clock source during sleep is to be selected, and * - @ref TMR_CLK_SRC_DURING_TRX_AWAKE if clock source while being awake is selected. */ void pal_timer_source_select(source_type_t source) { if (TMR_CLK_SRC_DURING_TRX_SLEEP == source) { TIMER_SRC_DURING_TRX_SLEEP(); } else { TIMER_SRC_DURING_TRX_AWAKE(); } }