[RF69] Added method to read version register
This commit is contained in:
parent
b4701c370b
commit
4c62de06cf
2 changed files with 16 additions and 2 deletions
|
@ -18,8 +18,8 @@ int16_t RF69::begin(float freq, float br, float freqDev, float rxBw, int8_t powe
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
// check version register
|
// check version register
|
||||||
uint8_t version = _mod->SPIreadRegister(RF69_REG_VERSION);
|
int16_t version = getChipVersion();
|
||||||
if(version == 0x24) {
|
if(version == RF69_CHIP_VERSION) {
|
||||||
flagFound = true;
|
flagFound = true;
|
||||||
} else {
|
} else {
|
||||||
#ifdef RADIOLIB_DEBUG
|
#ifdef RADIOLIB_DEBUG
|
||||||
|
@ -783,6 +783,10 @@ uint8_t RF69::random() {
|
||||||
return(randByte);
|
return(randByte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16_t RF69::getChipVersion() {
|
||||||
|
return(_mod->SPIgetRegValue(RF69_REG_VERSION));
|
||||||
|
}
|
||||||
|
|
||||||
int16_t RF69::config() {
|
int16_t RF69::config() {
|
||||||
int16_t state = ERR_NONE;
|
int16_t state = ERR_NONE;
|
||||||
|
|
||||||
|
|
|
@ -162,6 +162,9 @@
|
||||||
// RF69_REG_LISTEN_3
|
// RF69_REG_LISTEN_3
|
||||||
#define RF69_LISTEN_COEF_RX 0x20 // 7 0 duration of Rx phase in Listen mode
|
#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
|
// RF69_REG_PA_LEVEL
|
||||||
#define RF69_PA0_OFF 0b00000000 // 7 7 PA0 disabled
|
#define RF69_PA0_OFF 0b00000000 // 7 7 PA0 disabled
|
||||||
#define RF69_PA0_ON 0b10000000 // 7 7 PA0 enabled (default)
|
#define RF69_PA0_ON 0b10000000 // 7 7 PA0 enabled (default)
|
||||||
|
@ -827,6 +830,13 @@ class RF69: public PhysicalLayer {
|
||||||
*/
|
*/
|
||||||
uint8_t random();
|
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
|
#ifndef RADIOLIB_GODMODE
|
||||||
protected:
|
protected:
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue