[Si443x] Implemented RF switch control

This commit is contained in:
jgromes 2020-06-18 16:32:52 +02:00
parent 0f287a53e7
commit d1527b0d8c
2 changed files with 20 additions and 0 deletions

View file

@ -222,6 +222,9 @@ int16_t Si443x::startTransmit(uint8_t* data, size_t len, uint8_t addr) {
// write packet to FIFO
_mod->SPIwriteRegisterBurst(SI443X_REG_FIFO_ACCESS, data, len);
// set RF switch (if present)
_mod->setRfSwitchState(true);
// set mode to transmit
_mod->SPIwriteRegister(SI443X_REG_OP_FUNC_CONTROL_1, SI443X_TX_ON);
@ -246,6 +249,9 @@ int16_t Si443x::startReceive() {
// clear interrupt flags
clearIRQFlags();
// set RF switch (if present)
_mod->setRfSwitchState(false);
// set mode to receive
_mod->SPIwriteRegister(SI443X_REG_OP_FUNC_CONTROL_1, SI443X_RX_ON);
@ -504,6 +510,10 @@ int16_t Si443x::setDataShaping(float sh) {
}
}
void Si443x::setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn) {
_mod->setRfSwitchPins(rxEn, txEn);
}
int16_t Si443x::setFrequencyRaw(float newFreq) {
// set mode to standby
int16_t state = standby();

View file

@ -760,6 +760,16 @@ class Si443x: public PhysicalLayer {
*/
int16_t setDataShaping(float sh);
/*!
\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