[RF69] Added method to read version register

This commit is contained in:
jgromes 2020-11-20 17:52:47 +01:00
parent b4701c370b
commit 4c62de06cf
2 changed files with 16 additions and 2 deletions

View file

@ -18,8 +18,8 @@ int16_t RF69::begin(float freq, float br, float freqDev, float rxBw, int8_t powe
reset();
// check version register
uint8_t version = _mod->SPIreadRegister(RF69_REG_VERSION);
if(version == 0x24) {
int16_t version = getChipVersion();
if(version == RF69_CHIP_VERSION) {
flagFound = true;
} else {
#ifdef RADIOLIB_DEBUG
@ -783,6 +783,10 @@ uint8_t RF69::random() {
return(randByte);
}
int16_t RF69::getChipVersion() {
return(_mod->SPIgetRegValue(RF69_REG_VERSION));
}
int16_t RF69::config() {
int16_t state = ERR_NONE;

View file

@ -162,6 +162,9 @@
// RF69_REG_LISTEN_3
#define RF69_LISTEN_COEF_RX 0x20 // 7 0 duration of Rx phase in Listen mode
// RF69_REG_VERSION
#define RF69_CHIP_VERSION 0x24 // 7 0
// RF69_REG_PA_LEVEL
#define RF69_PA0_OFF 0b00000000 // 7 7 PA0 disabled
#define RF69_PA0_ON 0b10000000 // 7 7 PA0 enabled (default)
@ -827,6 +830,13 @@ class RF69: public PhysicalLayer {
*/
uint8_t random();
/*!
\brief Read version SPI register. Should return RF69_CHIP_VERSION (0x24) if SX127x is connected and working.
\returns Version register contents or \ref status_codes
*/
int16_t getChipVersion();
#ifndef RADIOLIB_GODMODE
protected:
#endif