arch/dev/radio/dw1000/dw1000.c
/*---------------------------------------------------------------------------*/
/* Callback to process RX good frame events */
Callback to process RX good frame events
Callback to process RX good frame events
static void
rx_ok_cb(const dwt_cb_data_t *cb_data)
{
#if DW1000_RANGING_ENABLED
  if(cb_data->rx_flags & DWT_CB_DATA_RX_FLAG_RNG) {
    dw1000_rng_ok_cb(cb_data);
      #if DW1000_READ_RXDIAG
        dwt_readdiagnostics(&dw1000_diag);
        dw1000_last_rxtime = RTIMER_NOW();
        dw1000_last_lqi = 107;
        float C = (float)(((uint32_t)dw1000_diag.maxGrowthCIR) << 17);
        float A = (DW1000_CONF_PRF == DWT_PRF_64M) ? 113.77f : 121.74f;
        uint16_t N = dw1000_diag.rxPreamCount;
        dw1000_last_rssi = 10.0f * (log10f(C) -
                log10f(N * N))
                - A;
        float F1 = (float)((uint32_t)dw1000_diag.firstPathAmp1);
        float F2 = (float)((uint32_t)dw1000_diag.firstPathAmp2);
        float F3 = (float)((uint32_t)dw1000_diag.firstPathAmp3);
        dw1000_last_fppl = 10.0f * (log10f(F1 * F1 + F2 * F2 + F3 * F3) -
                log10f(N * N))
                - A;
    #endif
    return;
  }
  dw1000_range_reset();
#endif
  data_len = cb_data->datalength - DW1000_CRC_LEN;
  frame_pending = true;
#if DEBUG
  radio_status = cb_data->status;
#endif
  if(auto_ack_enabled && (cb_data->status & SYS_STATUS_AAT)) {
    wait_ack_txdone = true;
  } else {
    wait_ack_txdone = false;
    process_poll(&dw1000_process);
  }
}
static void rx_ok_cb ( const dwt_cb_data_t * cb_data ) { #if DW1000_RANGING_ENABLED if ( cb_data -> rx_flags & DWT_CB_DATA_RX_FLAG_RNG ) { dw1000_rng_ok_cb ( cb_data ) ; #if DW1000_READ_RXDIAG dwt_readdiagnostics ( & dw1000_diag ) ; dw1000_last_rxtime = RTIMER_NOW ( ) ; dw1000_last_lqi = 107 ; float C = ( float ) ( ( ( uint32_t ) dw1000_diag . maxGrowthCIR ) << 17 ) ; float A = ( DW1000_CONF_PRF == DWT_PRF_64M ) ? 113.77f : 121.74f ; uint16_t N = dw1000_diag . rxPreamCount ; dw1000_last_rssi = 10.0f * ( log10f ( C ) - log10f ( N * N ) ) - A ; float F1 = ( float ) ( ( uint32_t ) dw1000_diag . firstPathAmp1 ) ; float F2 = ( float ) ( ( uint32_t ) dw1000_diag . firstPathAmp2 ) ; float F3 = ( float ) ( ( uint32_t ) dw1000_diag . firstPathAmp3 ) ; dw1000_last_fppl = 10.0f * ( log10f ( F1 * F1 + F2 * F2 + F3 * F3 ) - log10f ( N * N ) ) - A ; #endif return ; } dw1000_range_reset ( ) ; #endif data_len = cb_data -> datalength - DW1000_CRC_LEN ; frame_pending = true ; #if DEBUG radio_status = cb_data -> status ; #endif if ( auto_ack_enabled && ( cb_data -> status & SYS_STATUS_AAT ) ) { wait_ack_txdone = true ; } else { wait_ack_txdone = false ; process_poll ( & dw1000_process ) ; } }
Callback to process RX good frame events
Callback to process RX good frame events
/*LEDS_TOGGLE(LEDS_GREEN); */ // printf(" RX time %d fppl %d rssi %d %u %u \n",dw1000_last_rxtime,dw1000_last_fppl,dw1000_last_rssi,dw1000_diag.maxGrowthCIR, dw1000_diag.firstPath); /* rssi [dBm] = 10*log10((C*2^17)/N^2)-A
          * C = CIR_PWR (reg 0x12)
          * A = constant -> 113.77 for 16MHz PRF, 121.74 for 64MHz PRF
          * N = RXPACC (reg 0x10)
          */ /*FPPL = 10*log10((F1^1 + F2^2 + F3^2)/N^2) - A
        * F1 = FP_AMPL1 (reg 0x15)
        * F2 = FP_AMPL2 (reg 0x12)
        * F3 = FP_AMPL3 (reg 0x12)
        */ /* got a non-ranging packet: reset the ranging module if */ /* it was in the middle of ranging */ /* Set the appropriate event flag */ /* if we have auto-ACKs enabled and an ACK was requested, */ /* don't signal the reception until the TX done interrupt */ /*leds_on(LEDS_ORANGE); */