From 501ce04f0510a98aecb52009623bc002e93ed0aa Mon Sep 17 00:00:00 2001 From: kkrentz Date: Fri, 3 Aug 2018 03:12:00 -0700 Subject: [PATCH] cc2538-rf: Simplified set_channel --- arch/cpu/cc2538/dev/cc2538-rf.c | 14 ++------------ arch/cpu/cc2538/dev/cc2538-rf.h | 1 - 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/arch/cpu/cc2538/dev/cc2538-rf.c b/arch/cpu/cc2538/dev/cc2538-rf.c index 804870a47..eea715653 100644 --- a/arch/cpu/cc2538/dev/cc2538-rf.c +++ b/arch/cpu/cc2538/dev/cc2538-rf.c @@ -160,20 +160,14 @@ get_channel() /** * \brief Set the current operating channel * \param channel The desired channel as a value in [11,26] - * \return Returns a value in [11,26] representing the current channel - * or a negative value if \e channel was out of bounds */ -static int8_t +static void set_channel(uint8_t channel) { uint8_t was_on = 0; LOG_INFO("Set Channel\n"); - if((channel < CC2538_RF_CHANNEL_MIN) || (channel > CC2538_RF_CHANNEL_MAX)) { - return CC2538_RF_CHANNEL_SET_ERROR; - } - /* Changes to FREQCTRL take effect after the next recalibration */ /* If we are off, save state, otherwise switch off and save state */ @@ -190,8 +184,6 @@ set_channel(uint8_t channel) } rf_channel = channel; - - return (int8_t)channel; } /*---------------------------------------------------------------------------*/ static radio_value_t @@ -894,9 +886,7 @@ set_value(radio_param_t param, radio_value_t value) value > CC2538_RF_CHANNEL_MAX) { return RADIO_RESULT_INVALID_VALUE; } - if(set_channel(value) == CC2538_RF_CHANNEL_SET_ERROR) { - return RADIO_RESULT_ERROR; - } + set_channel(value); return RADIO_RESULT_OK; case RADIO_PARAM_PAN_ID: set_pan_id(value & 0xffff); diff --git a/arch/cpu/cc2538/dev/cc2538-rf.h b/arch/cpu/cc2538/dev/cc2538-rf.h index ffd8a6c08..958221783 100644 --- a/arch/cpu/cc2538/dev/cc2538-rf.h +++ b/arch/cpu/cc2538/dev/cc2538-rf.h @@ -56,7 +56,6 @@ #define CC2538_RF_CHANNEL_MIN 11 #define CC2538_RF_CHANNEL_MAX 26 #define CC2538_RF_CHANNEL_SPACING 5 -#define CC2538_RF_CHANNEL_SET_ERROR -1 #define CC2538_RF_MAX_PACKET_LEN 127 #define CC2538_RF_MIN_PACKET_LEN 4 #define CC2538_RF_CCA_CLEAR 1