[SX127x] Swap Tx IQ inversion (#778)
This commit is contained in:
parent
43ff5906c2
commit
8acaca4884
2 changed files with 8 additions and 6 deletions
|
@ -1503,20 +1503,22 @@ void SX127x::clearFIFO(size_t count) {
|
|||
}
|
||||
}
|
||||
|
||||
int16_t SX127x::invertIQ(bool invertIQ) {
|
||||
int16_t SX127x::invertIQ(bool enable) {
|
||||
// check active modem
|
||||
if(getActiveModem() != RADIOLIB_SX127X_LORA) {
|
||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||
}
|
||||
|
||||
// Tx path inversion is swapped, because it seems that setting it according to the datsheet
|
||||
// will actually lead to the wrong inversion. See https://github.com/jgromes/RadioLib/issues/778
|
||||
int16_t state;
|
||||
if(invertIQ) {
|
||||
if(enable) {
|
||||
state = this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_INVERT_IQ, RADIOLIB_SX127X_INVERT_IQ_RXPATH_ON, 6, 6);
|
||||
state |= this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_INVERT_IQ, RADIOLIB_SX127X_INVERT_IQ_TXPATH_ON, 0, 0);
|
||||
state |= this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_INVERT_IQ, RADIOLIB_SX127X_INVERT_IQ_TXPATH_OFF, 0, 0);
|
||||
state |= this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_INVERT_IQ2, RADIOLIB_SX127X_IQ2_ENABLE);
|
||||
} else {
|
||||
state = this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_INVERT_IQ, RADIOLIB_SX127X_INVERT_IQ_RXPATH_OFF, 6, 6);
|
||||
state |= this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_INVERT_IQ, RADIOLIB_SX127X_INVERT_IQ_TXPATH_OFF, 0, 0);
|
||||
state |= this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_INVERT_IQ, RADIOLIB_SX127X_INVERT_IQ_TXPATH_ON, 0, 0);
|
||||
state |= this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_INVERT_IQ2, RADIOLIB_SX127X_IQ2_DISABLE);
|
||||
}
|
||||
|
||||
|
|
|
@ -1086,10 +1086,10 @@ class SX127x: public PhysicalLayer {
|
|||
|
||||
/*!
|
||||
\brief Enable/disable inversion of the I and Q signals
|
||||
\param invertIQ QI inversion enabled (true) or disabled (false);
|
||||
\param enable QI inversion enabled (true) or disabled (false);
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t invertIQ(bool invertIQ);
|
||||
int16_t invertIQ(bool enable);
|
||||
|
||||
#if !defined(RADIOLIB_EXCLUDE_DIRECT_RECEIVE)
|
||||
/*!
|
||||
|
|
Loading…
Add table
Reference in a new issue