[RF69] Implemented RF switch control
This commit is contained in:
parent
3aafb2f5bf
commit
0f287a53e7
2 changed files with 20 additions and 0 deletions
|
@ -238,6 +238,9 @@ int16_t RF69::startReceive() {
|
|||
// clear interrupt flags
|
||||
clearIRQFlags();
|
||||
|
||||
// set RF switch (if present)
|
||||
_mod->setRfSwitchState(false);
|
||||
|
||||
// set mode to receive
|
||||
state = _mod->SPIsetRegValue(RF69_REG_OCP, RF69_OCP_ON | RF69_OCP_TRIM);
|
||||
state |= _mod->SPIsetRegValue(RF69_REG_TEST_PA1, RF69_PA1_NORMAL);
|
||||
|
@ -314,6 +317,9 @@ int16_t RF69::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
|
|||
RADIOLIB_ASSERT(state);
|
||||
}
|
||||
|
||||
// set RF switch (if present)
|
||||
_mod->setRfSwitchState(true);
|
||||
|
||||
// set mode to transmit
|
||||
state = setMode(RF69_TX);
|
||||
|
||||
|
@ -730,6 +736,10 @@ float RF69::getRSSI() {
|
|||
return(-1.0 * (_mod->SPIgetRegValue(RF69_REG_RSSI_VALUE)/2.0));
|
||||
}
|
||||
|
||||
void RF69::setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn) {
|
||||
_mod->setRfSwitchPins(rxEn, txEn);
|
||||
}
|
||||
|
||||
int16_t RF69::config() {
|
||||
int16_t state = ERR_NONE;
|
||||
|
||||
|
|
|
@ -795,6 +795,16 @@ class RF69: public PhysicalLayer {
|
|||
*/
|
||||
float getRSSI();
|
||||
|
||||
/*!
|
||||
\brief Some modules contain external RF switch controlled by two pins. This function gives RadioLib control over those two pins to automatically switch Rx and Tx state.
|
||||
When using automatic RF switch control, DO NOT change the pin mode of rxEn or txEn from Arduino sketch!
|
||||
|
||||
\param rxEn RX enable pin.
|
||||
|
||||
\param txEn TX enable pin.
|
||||
*/
|
||||
void setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn);
|
||||
|
||||
#ifndef RADIOLIB_GODMODE
|
||||
protected:
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue