arch/dev/radio/dw1000/dw1000-config.c
/* Configures the radio with the pre-defined default parameters */
Configures the radio with the pre-defined default parameters
Configures the radio with the pre - defined default parameters
bool
dw1000_reset_cfg() {
  if (dw1000_is_sleeping) {
    PRINTF("Err: Reset cfg requested while sleeping\n");
    return 0;
  }
  dwt_config_t default_cfg = {
    .chan = DW1000_CHANNEL,        
    .prf = DW1000_PRF,
    .txPreambLength = DW1000_PLEN,
    .rxPAC = DW1000_PAC,
    .txCode = DW1000_PREAMBLE_CODE,
    .rxCode = DW1000_PREAMBLE_CODE,
    .nsSFD = DW1000_SFD_MODE,
    .dataRate = DW1000_DATA_RATE,
    .phrMode = DW1000_PHR_MODE,
    .sfdTO = DW1000_SFD_TIMEOUT,
  };
  dw1000_configure(&default_cfg);
  bool smart;
  if (DW1000_DATA_RATE==DWT_BR_6M8) {
    smart = DW1000_SMART_TX_POWER_6M8;
  }
  else {
    smart = false;
  }
  dwt_txconfig_t tmp;
  dw1000_get_recommended_tx_cfg(&default_cfg, smart, &tmp);
#if defined(DW1000_CONF_TX_POWER)
  tmp.power = DW1000_CONF_TX_POWER;
#endif
#if defined(DW1000_CONF_PG_DELAY)
  tmp.PGdly = DW1000_CONF_PG_DELAY;
#endif
  dw1000_configure_tx(&tmp, smart);
  dw1000_configure_ant_dly(DW1000_CONF_RX_ANT_DLY, DW1000_CONF_TX_ANT_DLY);
  return 1;
}
bool dw1000_reset_cfg ( ) { if ( dw1000_is_sleeping ) { PRINTF ( " \n " ) ; return 0 ; } dwt_config_t default_cfg = { . chan = DW1000_CHANNEL , . prf = DW1000_PRF , . txPreambLength = DW1000_PLEN , . rxPAC = DW1000_PAC , . txCode = DW1000_PREAMBLE_CODE , . rxCode = DW1000_PREAMBLE_CODE , . nsSFD = DW1000_SFD_MODE , . dataRate = DW1000_DATA_RATE , . phrMode = DW1000_PHR_MODE , . sfdTO = DW1000_SFD_TIMEOUT , } ; dw1000_configure ( & default_cfg ) ; bool smart ; if ( DW1000_DATA_RATE == DWT_BR_6M8 ) { smart = DW1000_SMART_TX_POWER_6M8 ; } else { smart = false ; } dwt_txconfig_t tmp ; dw1000_get_recommended_tx_cfg ( & default_cfg , smart , & tmp ) ; #if defined ( DW1000_CONF_TX_POWER ) tmp . power = DW1000_CONF_TX_POWER ; #endif #if defined ( DW1000_CONF_PG_DELAY ) tmp . PGdly = DW1000_CONF_PG_DELAY ; #endif dw1000_configure_tx ( & tmp , smart ) ; dw1000_configure_ant_dly ( DW1000_CONF_RX_ANT_DLY , DW1000_CONF_TX_ANT_DLY ) ; return 1 ; }
Configures the radio with the pre-defined default parameters
Configures the radio with the pre - defined default parameters
// use the configuration constants // only makes sense for 6M8 // get the recommended values // force the tx power and pg delay settings from the configuration constants  // if they are defined, otherwise take the recommended value // set antenna delays