From ddeeb63ddd53c4b12b8d5090c9882eba43e03bf7 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Wed, 3 Oct 2018 13:31:33 +0200 Subject: [PATCH] CC1200 set_channel: compute channel within bounds from any input channel --- arch/dev/cc1200/cc1200.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/dev/cc1200/cc1200.c b/arch/dev/cc1200/cc1200.c index 2873c0629..d2b7db770 100644 --- a/arch/dev/cc1200/cc1200.c +++ b/arch/dev/cc1200/cc1200.c @@ -2115,6 +2115,9 @@ set_channel(uint8_t channel) uint8_t was_off = 0; uint32_t freq; + channel %= (CC1200_RF_CFG.max_channel - CC1200_RF_CFG.min_channel + 1); + channel += CC1200_RF_CFG.min_channel; + #if 0 /* * We explicitly allow a channel update even if the channel does not change.