[RFM9x] Using range check macro
This commit is contained in:
parent
274b38d556
commit
08e4c3b13b
2 changed files with 2 additions and 8 deletions
|
@ -35,10 +35,7 @@ int16_t RFM95::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncW
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RFM95::setFrequency(float freq) {
|
int16_t RFM95::setFrequency(float freq) {
|
||||||
// check frequency range
|
RADIOLIB_CHECK_RANGE(freq, 868.0, 915.0, ERR_INVALID_FREQUENCY);
|
||||||
if((freq < 868.0) || (freq > 915.0)) {
|
|
||||||
return(ERR_INVALID_FREQUENCY);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set frequency
|
// set frequency
|
||||||
return(SX127x::setFrequencyRaw(freq));
|
return(SX127x::setFrequencyRaw(freq));
|
||||||
|
|
|
@ -35,10 +35,7 @@ int16_t RFM96::begin(float freq, float bw, uint8_t sf, uint8_t cr, uint8_t syncW
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RFM96::setFrequency(float freq) {
|
int16_t RFM96::setFrequency(float freq) {
|
||||||
// check frequency range
|
RADIOLIB_CHECK_RANGE(freq, 433.0, 470.0, ERR_INVALID_FREQUENCY);
|
||||||
if((freq < 433.0) || (freq > 470.0)) {
|
|
||||||
return(ERR_INVALID_FREQUENCY);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set frequency
|
// set frequency
|
||||||
return(SX127x::setFrequencyRaw(freq));
|
return(SX127x::setFrequencyRaw(freq));
|
||||||
|
|
Loading…
Add table
Reference in a new issue