diff --git a/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c b/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c index 27d504a45..f7e7a0b62 100644 --- a/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c +++ b/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c @@ -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, }; /*---------------------------------------------------------------------------*/ diff --git a/dev/cc1200/cc1200-conf.h b/dev/cc1200/cc1200-conf.h index 9d28922a4..27dc6eb6e 100644 --- a/dev/cc1200/cc1200-conf.h +++ b/dev/cc1200/cc1200-conf.h @@ -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 * diff --git a/dev/cc1200/cc1200-rf-cfg.h b/dev/cc1200/cc1200-rf-cfg.h index 18d795c77..57af1f85a 100644 --- a/dev/cc1200/cc1200-rf-cfg.h +++ b/dev/cc1200/cc1200-rf-cfg.h @@ -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 */ diff --git a/dev/cc1200/cc1200.c b/dev/cc1200/cc1200.c index 490ffcb26..6e766855a 100644 --- a/dev/cc1200/cc1200.c +++ b/dev/cc1200/cc1200.c @@ -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