cc1200: configure RSSI offset as part of cc1200_rf_cfg

This commit is contained in:
Simon Duquennoy 2016-09-22 11:28:27 +02:00
parent 97843ed322
commit 622d576439
4 changed files with 7 additions and 13 deletions

View File

@ -57,6 +57,8 @@
#define RF_CFG_MAX_TXPOWER CC1200_CONST_TX_POWER_MAX
/* The carrier sense level used for CCA in dBm */
#define RF_CFG_CCA_THRESHOLD (-91)
/* The RSSI offset in dBm */
#define RF_CFG_RSSI_OFFSET (-81)
/*---------------------------------------------------------------------------*/
static const char rf_cfg_descriptor[] = "802.15.4g 863-870MHz MR-FSK mode #1";
/*---------------------------------------------------------------------------*/
@ -162,5 +164,6 @@ const cc1200_rf_cfg_t cc1200_802154g_863_870_fsk_50kbps = {
.max_channel = RF_CFG_MAX_CHANNEL,
.max_txpower = RF_CFG_MAX_TXPOWER,
.cca_threshold = RF_CFG_CCA_THRESHOLD,
.rssi_offset = RF_CFG_RSSI_OFFSET,
};
/*---------------------------------------------------------------------------*/

View File

@ -121,18 +121,6 @@
#define CC1200_RF_CFG cc1200_802154g_863_870_fsk_50kbps
#endif
/*---------------------------------------------------------------------------*/
/*
* The RSSI offset in dBm (int8_t)
*
* Might be hardware dependent, so we make it a configuration parameter.
* This parameter is written to AGC_GAIN_ADJUST.GAIN_ADJUSTMENT
*/
#ifdef CC1200_CONF_RSSI_OFFSET
#define CC1200_RSSI_OFFSET CC1200_CONF_RSSI_OFFSET
#else
#define CC1200_RSSI_OFFSET (-81)
#endif
/*---------------------------------------------------------------------------*/
/*
* The frequency offset
*

View File

@ -82,6 +82,9 @@ typedef struct cc1200_rf_cfg {
* CC1200_CONST_CCA_THRESHOLD_MIN and CC1200_CONST_CCA_THRESHOLD_MAX.
*/
int8_t cca_threshold;
/* The RSSI offset in dBm.
* -99 when MDMCFG1.DVGA_GAIN=00, -81 when MDMCFG1.DVGA_GAIN=01 */
int8_t rssi_offset;
} cc1200_rf_cfg_t;
/*---------------------------------------------------------------------------*/
#endif /* CC1200_RF_CFG_H */

View File

@ -1459,7 +1459,7 @@ configure(void)
#endif
/* RSSI offset */
single_write(CC1200_AGC_GAIN_ADJUST, (int8_t)CC1200_RSSI_OFFSET);
single_write(CC1200_AGC_GAIN_ADJUST, (int8_t)CC1200_RF_CFG.rssi_offset);
/***************************************************************************
* RF test modes needed during hardware development