arch/dev/radio/dw1000/glossy/glossy.c
/*---------------------------------------------------------------------------*/
/*                           UTILITY FUNCTIONS IMPLEMENTATION                */
/*---------------------------------------------------------------------------*/
/* Gives an RTIMER timestamp from a radio timestamp; radio_ts must be acquired
  * BEFORE calling radio_to_rtimer_ts()
  *
  * Source: uwb_contiki/examples/tdoa_mh_new/tdoa.c
  */
UTILITY FUNCTIONS IMPLEMENTATION
Gives an RTIMER timestamp from a radio timestamp; radio_ts must be acquired
BEFORE calling radio_to_rtimer_ts()


UTILITY FUNCTIONS IMPLEMENTATION Gives an RTIMER timestamp from a radio timestamp ; radio_ts must be acquired BEFORE calling radio_to_rtimer_ts ()
static rtimer_clock_t
radio_to_rtimer_ts(uint32_t radio_ts)
{
    uint32_t current_radio_ts = dwt_readsystimestamphi32();
    rtimer_clock_t current_rtimer_ts = RTIMER_NOW();
    double elapsed_s;
    elapsed_s = (double)(current_radio_ts - radio_ts) / 1000000000 * 4.0064102564;
    return current_rtimer_ts - (elapsed_s * RTIMER_SECOND);
}
static rtimer_clock_t radio_to_rtimer_ts ( uint32_t radio_ts ) { uint32_t current_radio_ts = dwt_readsystimestamphi32 ( ) ; rtimer_clock_t current_rtimer_ts = RTIMER_NOW ( ) ; double elapsed_s ; elapsed_s = ( double ) ( current_radio_ts - radio_ts ) / 1000000000 * 4.0064102564 ; return current_rtimer_ts - ( elapsed_s * RTIMER_SECOND ) ; }
UTILITY FUNCTIONS IMPLEMENTATION
Gives an RTIMER timestamp from a radio timestamp; radio_ts must be acquired
 BEFORE calling radio_to_rtimer_ts()
UTILITY FUNCTIONS IMPLEMENTATION Gives an RTIMER timestamp from a radio timestamp ; radio_ts must be acquired BEFORE calling radio_to_rtimer_ts ()