From 97843ed32218752de08b32e5bcf13156fa1427b6 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 22 Sep 2016 11:27:18 +0200 Subject: [PATCH] cc1200: use Hz instead of kHz for channel spacing --- dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c | 4 ++-- dev/cc1200/cc1200-rf-cfg.h | 4 ++-- dev/cc1200/cc1200.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c b/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c index 95fae730c..27d504a45 100644 --- a/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c +++ b/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c @@ -47,8 +47,8 @@ /* Base frequency in kHz */ #define RF_CFG_CHAN_CENTER_F0 863125 -/* Channel spacing in kHz */ -#define RF_CFG_CHAN_SPACING 200 +/* Channel spacing in Hz */ +#define RF_CFG_CHAN_SPACING 200000 /* The minimum channel */ #define RF_CFG_MIN_CHANNEL 0 /* The maximum channel */ diff --git a/dev/cc1200/cc1200-rf-cfg.h b/dev/cc1200/cc1200-rf-cfg.h index c7ba53527..18d795c77 100644 --- a/dev/cc1200/cc1200-rf-cfg.h +++ b/dev/cc1200/cc1200-rf-cfg.h @@ -69,8 +69,8 @@ typedef struct cc1200_rf_cfg { rtimer_clock_t tx_pkt_lifetime; /* Base frequency in kHz */ uint32_t chan_center_freq0; - /* Channel spacing in kHz */ - uint16_t chan_spacing; + /* Channel spacing in Hz */ + uint32_t chan_spacing; /* The minimum channel */ uint8_t min_channel; /* The maximum channel */ diff --git a/dev/cc1200/cc1200.c b/dev/cc1200/cc1200.c index 013c54ee6..490ffcb26 100644 --- a/dev/cc1200/cc1200.c +++ b/dev/cc1200/cc1200.c @@ -2013,7 +2013,7 @@ calculate_freq(uint8_t channel) uint32_t freq; - freq = CC1200_RF_CFG.chan_center_freq0 + channel * CC1200_RF_CFG.chan_spacing; + freq = CC1200_RF_CFG.chan_center_freq0 + (channel * CC1200_RF_CFG.chan_spacing) / 1000 /* /1000 because chan_spacing is in Hz */; freq *= FREQ_MULTIPLIER; freq /= FREQ_DIVIDER;