Merge pull request #142 from ortegafernando/master

Add getPowerLevel function
This commit is contained in:
Felix Rusu 2020-06-02 10:28:02 -04:00 committed by GitHub
commit 8b0c3c9278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -241,6 +241,11 @@ void RFM69::setPowerLevel(uint8_t powerLevel)
writeReg(REG_PALEVEL, (readReg(REG_PALEVEL) & 0xE0) | _powerLevel);
}
uint8_t RFM69::getPowerLevel() // get powerLevel
{
return _powerLevel;
}
bool RFM69::canSend()
{
if (_mode == RF69_MODE_RX && PAYLOADLEN == 0 && readRSSI() < CSMA_LIMIT) // if signal stronger than -100dBm is detected assume channel activity
@ -1202,4 +1207,4 @@ void RFM69::listenModeSendBurst( uint8_t targetNode, const void* buffer, uint8_t
setMode(RF69_MODE_STANDBY);
reinitRadio();
}
#endif
#endif

View File

@ -218,6 +218,7 @@ class RFM69 {
//void promiscuous(bool onOff=true); //replaced with spyMode()
virtual void setHighPower(bool onOFF=true); // has to be called after initialize() for RFM69HW
virtual void setPowerLevel(uint8_t level); // reduce/increase transmit power level
uint8_t getPowerLevel(); // get powerLevel
void sleep();
uint8_t readTemperature(uint8_t calFactor=0); // get CMOS temperature (8bit)
void rcCalibration(); // calibrate the internal RC oscillator for use in wide temperature variations - see datasheet section [4.3.5. RC Timer Accuracy]
@ -314,4 +315,4 @@ class RFM69 {
#endif
};
#endif
#endif