RF69::setOOK

This commit is contained in:
Christophe Painchaud 2021-03-16 15:38:05 +01:00
parent be1471c32a
commit b1c98569ea
2 changed files with 25 additions and 0 deletions

View file

@ -369,6 +369,21 @@ int16_t RF69::readData(uint8_t* data, size_t len) {
return(ERR_NONE);
}
int16_t RF69::setOOK(bool enableOOK) {
// set OOK and if successful, save the new setting
int16_t state = ERR_NONE;
if(enableOOK) {
state = _mod->SPIsetRegValue(RF69_REG_DATA_MODUL, RF69_OOK, 4, 3, 5);
} else {
state = _mod->SPIsetRegValue(RF69_REG_DATA_MODUL, RF69_FSK, 4, 3, 5);
}
if(state == ERR_NONE) {
_ook = enableOOK;
}
return(state);
}
int16_t RF69::setFrequency(float freq) {
// check allowed frequency range
if(!(((freq > 290.0) && (freq < 340.0)) ||

View file

@ -734,6 +734,15 @@ class RF69: public PhysicalLayer {
*/
size_t getPacketLength(bool update = true) override;
/*!
\brief Enables/disables OOK modulation instead of FSK.
\param enableOOK Enable (true) or disable (false) OOK.
\returns \ref status_codes
*/
int16_t setOOK(bool enableOOK);
/*!
\brief Set modem in fixed packet length mode.
@ -848,6 +857,7 @@ class RF69: public PhysicalLayer {
float _br = 0;
float _rxBw = 0;
bool _ook = false;
int16_t _tempOffset = 0;
int8_t _power = 0;