[RF69] OOK functions style cleanup

This commit is contained in:
jgromes 2021-03-26 05:54:52 +01:00
parent dec9cb0cfb
commit 31b7bfefe0
2 changed files with 19 additions and 21 deletions

View file

@ -370,28 +370,25 @@ int16_t RF69::readData(uint8_t* data, size_t len) {
} }
int16_t RF69::setOOK(bool enableOOK) { int16_t RF69::setOOK(bool enableOOK) {
// set OOK and if successful, save the new setting // set OOK and if successful, save the new setting
int16_t state = ERR_NONE; int16_t state = ERR_NONE;
if(enableOOK) { if(enableOOK) {
state = _mod->SPIsetRegValue(RF69_REG_DATA_MODUL, RF69_OOK, 4, 3, 5); state = _mod->SPIsetRegValue(RF69_REG_DATA_MODUL, RF69_OOK, 4, 3, 5);
} else { } else {
state = _mod->SPIsetRegValue(RF69_REG_DATA_MODUL, RF69_FSK, 4, 3, 5); state = _mod->SPIsetRegValue(RF69_REG_DATA_MODUL, RF69_FSK, 4, 3, 5);
} }
if(state == ERR_NONE) { if(state == ERR_NONE) {
_ook = enableOOK; _ook = enableOOK;
} }
return(state); return(state);
} }
int16_t RF69::setOokThresholdType(uint8_t type) { int16_t RF69::setOokThresholdType(uint8_t type) {
if(type != RF69_OOK_THRESH_FIXED && type != RF69_OOK_THRESH_PEAK && type != RF69_OOK_THRESH_AVERAGE) if((type != RF69_OOK_THRESH_FIXED) && (type != RF69_OOK_THRESH_PEAK) && (type != RF69_OOK_THRESH_AVERAGE)) {
return ERR_INVALID_OOK_RSSI_PEAK_TYPE; return(ERR_INVALID_OOK_RSSI_PEAK_TYPE);
}
int16_t state = ERR_NONE; return(_mod->SPIsetRegValue(RF69_REG_OOK_PEAK, type, 7, 3, 5));
state = _mod->SPIsetRegValue(RF69_REG_OOK_PEAK, type, 7, 3, 5);
return(state);
} }
int16_t RF69::setFrequency(float freq) { int16_t RF69::setFrequency(float freq) {

View file

@ -751,7 +751,8 @@ class RF69: public PhysicalLayer {
/*! /*!
\brief Selects the type of threshold in the OOK data slicer \brief Selects the type of threshold in the OOK data slicer
\param type RF69_OOK_THRESH_FIXED RF69_OOK_THRESH_PEAK(default) RF69_OOK_THRESH_AVERAGE \param type Threshold type: RF69_OOK_THRESH_PEAK(default), RF69_OOK_THRESH_FIXED or RF69_OOK_THRESH_AVERAGE
\returns \ref status_codes \returns \ref status_codes
*/ */
int16_t setOokThresholdType(uint8_t type); int16_t setOokThresholdType(uint8_t type);
@ -829,9 +830,9 @@ class RF69: public PhysicalLayer {
int16_t setEncoding(uint8_t encoding) override; int16_t setEncoding(uint8_t encoding) override;
/*! /*!
\brief enable/disable LNA Boost mode (disabled by default \brief Enable/disable LNA Boost mode (disabled by default).
\param value true to enable, false to disable \param value True to enable, false to disable.
\returns \ref status_codes \returns \ref status_codes
*/ */