arch/dev/radio/dw1000/dw1000-config.c
/* Get the recommended tx config for the given radio config and the smart TX 
 * power control feature. 
 *
 * Returns false if the requested configuration is not supported.
 */
Get the recommended tx config for the given radio config and the smart TX
power control feature.

Returns false if the requested configuration is not supported.
Get the recommended tx config for the given radio config and the smart TX power control feature . Returns false if the requested configuration is not supported .
bool
dw1000_get_recommended_tx_cfg(const dwt_config_t* const cfg, bool smart, dwt_txconfig_t* tx_cfg) {
  int ch_idx;
  int prf_idx;
  int smart_idx;
  if (smart && (cfg->dataRate!=DWT_BR_6M8)) {
    return false;
  }
  if (cfg->chan < 1 || cfg->chan > 7 || cfg->chan == 6) {
    return false;
  }
  if (cfg->prf == DWT_PRF_16M) {
    prf_idx = 0;
  }
  else if (cfg->prf == DWT_PRF_64M) {
    prf_idx = 1;
  }
  else {
    return false;
  }
  if (cfg->chan == 7) {
    ch_idx = 5;
  }
  else {
    ch_idx = cfg->chan-1;
  }
  smart_idx = smart?1:0;
  tx_cfg->PGdly = pgdly_tbl[ch_idx];
  tx_cfg->power = tx_power_tbl[smart_idx][ch_idx][prf_idx];
  return true;
}
bool dw1000_get_recommended_tx_cfg ( const dwt_config_t * const cfg , bool smart , dwt_txconfig_t * tx_cfg ) { int ch_idx ; int prf_idx ; int smart_idx ; if ( smart && ( cfg -> dataRate != DWT_BR_6M8 ) ) { return false ; } if ( cfg -> chan < 1 || cfg -> chan > 7 || cfg -> chan == 6 ) { return false ; } if ( cfg -> prf == DWT_PRF_16M ) { prf_idx = 0 ; } else if ( cfg -> prf == DWT_PRF_64M ) { prf_idx = 1 ; } else { return false ; } if ( cfg -> chan == 7 ) { ch_idx = 5 ; } else { ch_idx = cfg -> chan - 1 ; } smart_idx = smart ? 1 : 0 ; tx_cfg -> PGdly = pgdly_tbl [ ch_idx ] ; tx_cfg -> power = tx_power_tbl [ smart_idx ] [ ch_idx ] [ prf_idx ] ; return true ; }
Get the recommended tx config for the given radio config and the smart TX
 power control feature.
Get the recommended tx config for the given radio config and the smart TX power control feature .