Move helper functions from SX1276/7/8/9 to global SX127x.
This commit is contained in:
parent
c4fec32965
commit
06ef449b68
10 changed files with 49 additions and 196 deletions
|
@ -70,26 +70,4 @@ int16_t SX1276::setFrequency(float freq) {
|
|||
return(state);
|
||||
}
|
||||
|
||||
int16_t SX1276::setFHSSHoppingPeriod(uint8_t freqHoppingPeriod) {
|
||||
return(_mod->SPIsetRegValue(RADIOLIB_SX127X_REG_HOP_PERIOD, freqHoppingPeriod));
|
||||
}
|
||||
|
||||
uint8_t SX1276::getFHSSHoppingPeriod(void) {
|
||||
return(_mod->SPIgetRegValue(RADIOLIB_SX127X_REG_HOP_PERIOD));
|
||||
}
|
||||
|
||||
uint8_t SX1276::getFHSSChannel(void) {
|
||||
return(_mod->SPIgetRegValue(RADIOLIB_SX127X_REG_HOP_CHANNEL, 5, 0));
|
||||
}
|
||||
|
||||
void SX1276::clearFHSSInt(void) {
|
||||
int16_t modem = getActiveModem();
|
||||
if(modem == RADIOLIB_SX127X_LORA) {
|
||||
_mod->SPIwriteRegister(RADIOLIB_SX127X_REG_IRQ_FLAGS, getIRQFlags() | RADIOLIB_SX127X_CLEAR_IRQ_FLAG_FHSS_CHANGE_CHANNEL);
|
||||
} else if(modem == RADIOLIB_SX127X_FSK_OOK) {
|
||||
return; //These are not the interrupts you are looking for
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -84,34 +84,6 @@ class SX1276: public SX1278 {
|
|||
*/
|
||||
int16_t setFrequency(float freq);
|
||||
|
||||
/*!
|
||||
\brief Sets the hopping period and enables FHSS
|
||||
|
||||
\param freqHoppingPeriod Integer multiple of symbol periods between hops
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setFHSSHoppingPeriod(uint8_t freqHoppingPeriod);
|
||||
|
||||
/*!
|
||||
\brief Gets FHSS hopping period
|
||||
|
||||
\returns 8 bit period
|
||||
*/
|
||||
uint8_t getFHSSHoppingPeriod(void);
|
||||
|
||||
/*!
|
||||
\brief Gets the FHSS channel in use
|
||||
|
||||
\returns 6 bit channel number
|
||||
*/
|
||||
uint8_t getFHSSChannel(void);
|
||||
|
||||
/*!
|
||||
\brief Clear the FHSS interrupt
|
||||
*/
|
||||
void clearFHSSInt(void);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
private:
|
||||
#endif
|
||||
|
|
|
@ -100,24 +100,4 @@ int16_t SX1277::setSpreadingFactor(uint8_t sf) {
|
|||
return(state);
|
||||
}
|
||||
|
||||
int16_t SX1277::setFHSSHoppingPeriod(uint8_t freqHoppingPeriod) {
|
||||
return(_mod->SPIsetRegValue(RADIOLIB_SX127X_REG_HOP_PERIOD, freqHoppingPeriod));
|
||||
}
|
||||
|
||||
uint8_t SX1277::getFHSSHoppingPeriod(void) {
|
||||
return(_mod->SPIgetRegValue(RADIOLIB_SX127X_REG_HOP_PERIOD));
|
||||
}
|
||||
|
||||
uint8_t SX1277::getFHSSChannel(void) {
|
||||
return(_mod->SPIgetRegValue(RADIOLIB_SX127X_REG_HOP_CHANNEL, 5, 0));
|
||||
}
|
||||
|
||||
void SX1277::clearFHSSInt(void) {
|
||||
int16_t modem = getActiveModem();
|
||||
if(modem == RADIOLIB_SX127X_LORA) {
|
||||
_mod->SPIwriteRegister(RADIOLIB_SX127X_REG_IRQ_FLAGS, getIRQFlags() | RADIOLIB_SX127X_CLEAR_IRQ_FLAG_FHSS_CHANGE_CHANNEL);
|
||||
} else if(modem == RADIOLIB_SX127X_FSK_OOK) {
|
||||
return; //These are not the interrupts you are looking for
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -93,34 +93,6 @@ class SX1277: public SX1278 {
|
|||
*/
|
||||
int16_t setSpreadingFactor(uint8_t sf);
|
||||
|
||||
/*!
|
||||
\brief Sets the hopping period and enables FHSS
|
||||
|
||||
\param freqHoppingPeriod Integer multiple of symbol periods between hops
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setFHSSHoppingPeriod(uint8_t freqHoppingPeriod);
|
||||
|
||||
/*!
|
||||
\brief Gets FHSS hopping period
|
||||
|
||||
\returns 8 bit period
|
||||
*/
|
||||
uint8_t getFHSSHoppingPeriod(void);
|
||||
|
||||
/*!
|
||||
\brief Gets the FHSS channel in use
|
||||
|
||||
\returns 6 bit channel number
|
||||
*/
|
||||
uint8_t getFHSSChannel(void);
|
||||
|
||||
/*!
|
||||
\brief Clear the FHSS interrupt
|
||||
*/
|
||||
void clearFHSSInt(void);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
private:
|
||||
#endif
|
||||
|
|
|
@ -623,25 +623,4 @@ void SX1278::errataFix(bool rx) {
|
|||
_mod->SPIsetRegValue(0x30, fixedRegs[2]);
|
||||
}
|
||||
|
||||
int16_t SX1278::setFHSSHoppingPeriod(uint8_t freqHoppingPeriod) {
|
||||
return(_mod->SPIsetRegValue(RADIOLIB_SX127X_REG_HOP_PERIOD, freqHoppingPeriod));
|
||||
}
|
||||
|
||||
uint8_t SX1278::getFHSSHoppingPeriod(void) {
|
||||
return(_mod->SPIgetRegValue(RADIOLIB_SX127X_REG_HOP_PERIOD));
|
||||
}
|
||||
|
||||
uint8_t SX1278::getFHSSChannel(void) {
|
||||
return(_mod->SPIgetRegValue(RADIOLIB_SX127X_REG_HOP_CHANNEL, 5, 0));
|
||||
}
|
||||
|
||||
void SX1278::clearFHSSInt(void) {
|
||||
int16_t modem = getActiveModem();
|
||||
if(modem == RADIOLIB_SX127X_LORA) {
|
||||
_mod->SPIwriteRegister(RADIOLIB_SX127X_REG_IRQ_FLAGS, getIRQFlags() | RADIOLIB_SX127X_CLEAR_IRQ_FLAG_FHSS_CHANGE_CHANNEL);
|
||||
} else if(modem == RADIOLIB_SX127X_FSK_OOK) {
|
||||
return; //These are not the interrupts you are looking for
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -302,34 +302,6 @@ class SX1278: public SX127x {
|
|||
*/
|
||||
int16_t explicitHeader();
|
||||
|
||||
/*!
|
||||
\brief Sets the hopping period and enables FHSS
|
||||
|
||||
\param freqHoppingPeriod Integer multiple of symbol periods between hops
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setFHSSHoppingPeriod(uint8_t freqHoppingPeriod);
|
||||
|
||||
/*!
|
||||
\brief Gets FHSS hopping period
|
||||
|
||||
\returns 8 bit period
|
||||
*/
|
||||
uint8_t getFHSSHoppingPeriod(void);
|
||||
|
||||
/*!
|
||||
\brief Gets the FHSS channel in use
|
||||
|
||||
\returns 6 bit channel number
|
||||
*/
|
||||
uint8_t getFHSSChannel(void);
|
||||
|
||||
/*!
|
||||
\brief Clear the FHSS interrupt
|
||||
*/
|
||||
void clearFHSSInt(void);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
protected:
|
||||
#endif
|
||||
|
|
|
@ -70,25 +70,4 @@ int16_t SX1279::setFrequency(float freq) {
|
|||
return(state);
|
||||
}
|
||||
|
||||
int16_t SX1279::setFHSSHoppingPeriod(uint8_t freqHoppingPeriod) {
|
||||
return(_mod->SPIsetRegValue(RADIOLIB_SX127X_REG_HOP_PERIOD, freqHoppingPeriod));
|
||||
}
|
||||
|
||||
uint8_t SX1279::getFHSSHoppingPeriod(void) {
|
||||
return(_mod->SPIgetRegValue(RADIOLIB_SX127X_REG_HOP_PERIOD));
|
||||
}
|
||||
|
||||
uint8_t SX1279::getFHSSChannel(void) {
|
||||
return(_mod->SPIgetRegValue(RADIOLIB_SX127X_REG_HOP_CHANNEL, 5, 0));
|
||||
}
|
||||
|
||||
void SX1279::clearFHSSInt(void) {
|
||||
int16_t modem = getActiveModem();
|
||||
if(modem == RADIOLIB_SX127X_LORA) {
|
||||
_mod->SPIwriteRegister(RADIOLIB_SX127X_REG_IRQ_FLAGS, getIRQFlags() | RADIOLIB_SX127X_CLEAR_IRQ_FLAG_FHSS_CHANGE_CHANNEL);
|
||||
} else if(modem == RADIOLIB_SX127X_FSK_OOK) {
|
||||
return; //These are not the interrupts you are looking for
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -84,34 +84,6 @@ class SX1279: public SX1278 {
|
|||
*/
|
||||
int16_t setFrequency(float freq);
|
||||
|
||||
/*!
|
||||
\brief Sets the hopping period and enables FHSS
|
||||
|
||||
\param freqHoppingPeriod Integer multiple of symbol periods between hops
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setFHSSHoppingPeriod(uint8_t freqHoppingPeriod);
|
||||
|
||||
/*!
|
||||
\brief Gets FHSS hopping period
|
||||
|
||||
\returns 8 bit period
|
||||
*/
|
||||
uint8_t getFHSSHoppingPeriod(void);
|
||||
|
||||
/*!
|
||||
\brief Gets the FHSS channel in use
|
||||
|
||||
\returns 6 bit channel number
|
||||
*/
|
||||
uint8_t getFHSSChannel(void);
|
||||
|
||||
/*!
|
||||
\brief Clear the FHSS interrupt
|
||||
*/
|
||||
void clearFHSSInt(void);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE)
|
||||
private:
|
||||
#endif
|
||||
|
|
|
@ -1367,4 +1367,25 @@ void SX127x::readBit(RADIOLIB_PIN_TYPE pin) {
|
|||
updateDirectBuffer((uint8_t)digitalRead(pin));
|
||||
}
|
||||
|
||||
int16_t SX127x::setFHSSHoppingPeriod(uint8_t freqHoppingPeriod) {
|
||||
return(_mod->SPIsetRegValue(RADIOLIB_SX127X_REG_HOP_PERIOD, freqHoppingPeriod));
|
||||
}
|
||||
|
||||
uint8_t SX127x::getFHSSHoppingPeriod(void) {
|
||||
return(_mod->SPIgetRegValue(RADIOLIB_SX127X_REG_HOP_PERIOD));
|
||||
}
|
||||
|
||||
uint8_t SX127x::getFHSSChannel(void) {
|
||||
return(_mod->SPIgetRegValue(RADIOLIB_SX127X_REG_HOP_CHANNEL, 5, 0));
|
||||
}
|
||||
|
||||
void SX127x::clearFHSSInt(void) {
|
||||
int16_t modem = getActiveModem();
|
||||
if(modem == RADIOLIB_SX127X_LORA) {
|
||||
_mod->SPIwriteRegister(RADIOLIB_SX127X_REG_IRQ_FLAGS, getIRQFlags() | RADIOLIB_SX127X_CLEAR_IRQ_FLAG_FHSS_CHANGE_CHANNEL);
|
||||
} else if(modem == RADIOLIB_SX127X_FSK_OOK) {
|
||||
return; //These are not the interrupts you are looking for
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1073,6 +1073,34 @@ class SX127x: public PhysicalLayer {
|
|||
*/
|
||||
void readBit(RADIOLIB_PIN_TYPE pin);
|
||||
|
||||
/*!
|
||||
\brief Sets the hopping period and enables FHSS
|
||||
|
||||
\param freqHoppingPeriod Integer multiple of symbol periods between hops
|
||||
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t setFHSSHoppingPeriod(uint8_t freqHoppingPeriod);
|
||||
|
||||
/*!
|
||||
\brief Gets FHSS hopping period
|
||||
|
||||
\returns 8 bit period
|
||||
*/
|
||||
uint8_t getFHSSHoppingPeriod(void);
|
||||
|
||||
/*!
|
||||
\brief Gets the FHSS channel in use
|
||||
|
||||
\returns 6 bit channel number
|
||||
*/
|
||||
uint8_t getFHSSChannel(void);
|
||||
|
||||
/*!
|
||||
\brief Clear the FHSS interrupt
|
||||
*/
|
||||
void clearFHSSInt(void);
|
||||
|
||||
#if !defined(RADIOLIB_GODMODE) && !defined(RADIOLIB_LOW_LEVEL)
|
||||
protected:
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue