Merge pull request #501 from loopj/rf69-persist-bitsync
[RF69] Persist bit synchronization settings
This commit is contained in:
commit
ed4de04afa
2 changed files with 19 additions and 3 deletions
|
@ -223,7 +223,11 @@ int16_t RF69::directMode() {
|
||||||
RADIOLIB_ASSERT(state);
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
// set continuous mode
|
// set continuous mode
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE_WITH_SYNC, 6, 5));
|
if(_bitSync) {
|
||||||
|
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE_WITH_SYNC, 6, 5));
|
||||||
|
} else {
|
||||||
|
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE, 6, 5));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::packetMode() {
|
int16_t RF69::packetMode() {
|
||||||
|
@ -666,11 +670,21 @@ int16_t RF69::disableSyncWordFiltering() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::enableContinuousModeBitSync() {
|
int16_t RF69::enableContinuousModeBitSync() {
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE_WITH_SYNC, 6, 5));
|
int16_t state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE_WITH_SYNC, 6, 5);
|
||||||
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
|
_bitSync = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::disableContinuousModeBitSync() {
|
int16_t RF69::disableContinuousModeBitSync() {
|
||||||
return(_mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE, 6, 5));
|
int16_t state = _mod->SPIsetRegValue(RADIOLIB_RF69_REG_DATA_MODUL, RADIOLIB_RF69_CONTINUOUS_MODE, 6, 5);
|
||||||
|
if(state == RADIOLIB_ERR_NONE) {
|
||||||
|
_bitSync = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t RF69::setCrcFiltering(bool crcOn) {
|
int16_t RF69::setCrcFiltering(bool crcOn) {
|
||||||
|
|
|
@ -942,6 +942,8 @@ class RF69: public PhysicalLayer {
|
||||||
|
|
||||||
uint8_t _syncWordLength = 2;
|
uint8_t _syncWordLength = 2;
|
||||||
|
|
||||||
|
bool _bitSync = true;
|
||||||
|
|
||||||
int16_t config();
|
int16_t config();
|
||||||
int16_t directMode();
|
int16_t directMode();
|
||||||
int16_t setPacketMode(uint8_t mode, uint8_t len);
|
int16_t setPacketMode(uint8_t mode, uint8_t len);
|
||||||
|
|
Loading…
Add table
Reference in a new issue