[SX127x] Rename preamble inversion method
This commit is contained in:
parent
848df9a175
commit
10a9705204
3 changed files with 9 additions and 8 deletions
|
@ -124,7 +124,7 @@ setSyncWord KEYWORD2
|
|||
setOutputPower KEYWORD2
|
||||
setCurrentLimit KEYWORD2
|
||||
setPreambleLength KEYWORD2
|
||||
setPreamblePolarity KEYWORD2
|
||||
invertPreamble KEYWORD2
|
||||
setGain KEYWORD2
|
||||
getFrequencyError KEYWORD2
|
||||
getRSSI KEYWORD2
|
||||
|
|
|
@ -119,7 +119,7 @@ int16_t SX127x::beginFSK(uint8_t* chipVersions, uint8_t numVersions, float freqD
|
|||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set preamble polarity
|
||||
state = setPreamblePolarity(RADIOLIB_SX127X_PREAMBLE_POLARITY_55);
|
||||
state = invertPreamble(false);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set default sync word
|
||||
|
@ -786,7 +786,7 @@ int16_t SX127x::setPreambleLength(size_t preambleLength) {
|
|||
return(RADIOLIB_ERR_UNKNOWN);
|
||||
}
|
||||
|
||||
int16_t SX127x::setPreamblePolarity(int polarity) {
|
||||
int16_t SX127x::invertPreamble(bool enable) {
|
||||
// set mode to standby
|
||||
int16_t state = setMode(RADIOLIB_SX127X_STANDBY);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
@ -794,10 +794,11 @@ int16_t SX127x::setPreamblePolarity(int polarity) {
|
|||
// check active modem
|
||||
uint8_t modem = getActiveModem();
|
||||
if(modem == RADIOLIB_SX127X_LORA) {
|
||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||
} else if(modem == RADIOLIB_SX127X_FSK_OOK) {
|
||||
// set preamble polarity
|
||||
state =this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_SYNC_CONFIG, polarity, 5, 5);
|
||||
uint8_t polarity = enable ? RADIOLIB_SX127X_PREAMBLE_POLARITY_AA : RADIOLIB_SX127X_PREAMBLE_POLARITY_55;
|
||||
state = this->mod->SPIsetRegValue(RADIOLIB_SX127X_REG_SYNC_CONFIG, polarity, 5, 5);
|
||||
return(state);
|
||||
}
|
||||
|
||||
|
|
|
@ -879,11 +879,11 @@ class SX127x: public PhysicalLayer {
|
|||
int16_t setPreambleLength(size_t preambleLength) override;
|
||||
|
||||
/*!
|
||||
\brief Sets FSK preamble polarity. Allowed values are RADIOLIB_SX127X_PREAMBLE_POLARITY_55 or RADIOLIB_SX127X_PREAMBLE_POLARITY_AA. Not allowed in LoRa mode.
|
||||
\param polarity Preamble polarity bit in FSK mode).
|
||||
\brief Invert FSK preamble polarity. The default (non-inverted) is 0x55, the inverted is 0xAA.
|
||||
\param enable Preamble polarity in FSK mode - 0xAA when true, 0x55 when false.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setPreamblePolarity(int polarity);
|
||||
int16_t invertPreamble(bool enable);
|
||||
|
||||
/*!
|
||||
\brief Gets frequency error of the latest received packet.
|
||||
|
|
Loading…
Add table
Reference in a new issue