add method to change preamble polarity in FSK mode
This commit is contained in:
parent
4423585491
commit
7af723ab7c
2 changed files with 25 additions and 0 deletions
|
@ -782,6 +782,24 @@ int16_t SX127x::setPreambleLength(size_t preambleLength) {
|
|||
return(RADIOLIB_ERR_UNKNOWN);
|
||||
}
|
||||
|
||||
int16_t SX127x::setPreamblePolarity(int polarity) {
|
||||
// set mode to standby
|
||||
int16_t state = setMode(RADIOLIB_SX127X_STANDBY);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// check active modem
|
||||
uint8_t modem = getActiveModem();
|
||||
if(modem == RADIOLIB_SX127X_LORA) {
|
||||
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);
|
||||
return(state);
|
||||
}
|
||||
|
||||
return(RADIOLIB_ERR_UNKNOWN);
|
||||
}
|
||||
|
||||
float SX127x::getFrequencyError(bool autoCorrect) {
|
||||
int16_t modem = getActiveModem();
|
||||
if(modem == RADIOLIB_SX127X_LORA) {
|
||||
|
|
|
@ -876,6 +876,13 @@ 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).
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setPreamblePolarity(int polarity);
|
||||
|
||||
/*!
|
||||
\brief Gets frequency error of the latest received packet.
|
||||
\param autoCorrect When set to true, frequency will be automatically corrected.
|
||||
|
|
Loading…
Add table
Reference in a new issue