Changed setRfSwitchState to directly change switch pins
This commit is contained in:
parent
bb7108a52b
commit
56360a2a05
2 changed files with 7 additions and 10 deletions
|
@ -323,18 +323,13 @@ void Module::setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn) {
|
||||||
Module::pinMode(txEn, OUTPUT);
|
Module::pinMode(txEn, OUTPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::setRfSwitchState(bool tx) {
|
void Module::setRfSwitchState(RADIOLIB_PIN_STATUS rxPinState, RADIOLIB_PIN_STATUS txPinState) {
|
||||||
// check RF switch control is enabled
|
// check RF switch control is enabled
|
||||||
if(!_useRfSwitch) {
|
if(!_useRfSwitch) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set pins
|
// set pins
|
||||||
if(tx) {
|
Module::digitalWrite(_rxEn, rxPinState);
|
||||||
Module::digitalWrite(_rxEn, LOW);
|
Module::digitalWrite(_txEn, txPinState);
|
||||||
Module::digitalWrite(_txEn, HIGH);
|
|
||||||
} else {
|
|
||||||
Module::digitalWrite(_rxEn, HIGH);
|
|
||||||
Module::digitalWrite(_txEn, LOW);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,9 +399,11 @@ class Module {
|
||||||
/*!
|
/*!
|
||||||
\brief Set RF switch state.
|
\brief Set RF switch state.
|
||||||
|
|
||||||
\param tx True to set RF switch to Tx, false to set switch to Rx.
|
\param rxPinState Pin state to set on Tx enable pin (usually high to transmit).
|
||||||
|
|
||||||
|
\param txPinState Pin state to set on Rx enable pin (usually high to receive).
|
||||||
*/
|
*/
|
||||||
void setRfSwitchState(bool tx);
|
void setRfSwitchState(RADIOLIB_PIN_STATUS rxPinState, RADIOLIB_PIN_STATUS txPinState);
|
||||||
|
|
||||||
#ifndef RADIOLIB_GODMODE
|
#ifndef RADIOLIB_GODMODE
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Reference in a new issue