kopia lustrzana https://github.com/jgromes/RadioLib
[LR1110] Added configurable LR-FHSS grid spacing
rodzic
6e66570241
commit
1f11cd1dd5
|
@ -31,9 +31,9 @@ int16_t LR1110::beginGFSK(float freq, float br, float freqDev, float rxBw, int8_
|
|||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR1110::beginLRFHSS(float freq, uint8_t bw, uint8_t cr, int8_t power, float tcxoVoltage) {
|
||||
int16_t LR1110::beginLRFHSS(float freq, uint8_t bw, uint8_t cr, bool narrowGrid, int8_t power, float tcxoVoltage) {
|
||||
// execute common part
|
||||
int16_t state = LR11x0::beginLRFHSS(bw, cr, tcxoVoltage);
|
||||
int16_t state = LR11x0::beginLRFHSS(bw, cr, narrowGrid, tcxoVoltage);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// configure publicly accessible settings
|
||||
|
|
|
@ -58,13 +58,14 @@ class LR1110: public LR11x0 {
|
|||
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
|
||||
\param bw LR-FHSS bandwidth, one of RADIOLIB_LR11X0_LR_FHSS_BW_* values. Defaults to 722.66 kHz.
|
||||
\param cr LR-FHSS coding rate, one of RADIOLIB_LR11X0_LR_FHSS_CR_* values. Defaults to 2/3 coding rate.
|
||||
\param narrowGrid Whether to use narrow (3.9 kHz) or wide (25.39 kHz) grid spacing. Defaults to true (narrow/non-FCC) grid.
|
||||
\param power Output power in dBm. Defaults to 10 dBm.
|
||||
\param tcxoVoltage TCXO reference voltage to be set. Defaults to 1.6 V.
|
||||
If you are seeing -706/-707 error codes, it likely means you are using non-0 value for module with XTAL.
|
||||
To use XTAL, either set this value to 0, or set LR11x0::XTAL to true.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t beginLRFHSS(float freq = 434.0, uint8_t bw = RADIOLIB_LR11X0_LR_FHSS_BW_722_66, uint8_t cr = RADIOLIB_LR11X0_LR_FHSS_CR_2_3, int8_t power = 10, float tcxoVoltage = 1.6);
|
||||
int16_t beginLRFHSS(float freq = 434.0, uint8_t bw = RADIOLIB_LR11X0_LR_FHSS_BW_722_66, uint8_t cr = RADIOLIB_LR11X0_LR_FHSS_CR_2_3, bool narrowGrid = true, int8_t power = 10, float tcxoVoltage = 1.6);
|
||||
|
||||
// configuration methods
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ int16_t LR1120::beginGFSK(float freq, float br, float freqDev, float rxBw, int8_
|
|||
return(state);
|
||||
}
|
||||
|
||||
int16_t LR1120::beginLRFHSS(float freq, uint8_t bw, uint8_t cr, int8_t power, float tcxoVoltage) {
|
||||
int16_t LR1120::beginLRFHSS(float freq, uint8_t bw, uint8_t cr, bool narrowGrid, int8_t power, float tcxoVoltage) {
|
||||
// execute common part
|
||||
int16_t state = LR11x0::beginLRFHSS(bw, cr, tcxoVoltage);
|
||||
int16_t state = LR11x0::beginLRFHSS(bw, cr, narrowGrid, tcxoVoltage);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// configure publicly accessible settings
|
||||
|
|
|
@ -58,13 +58,14 @@ class LR1120: public LR11x0 {
|
|||
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
|
||||
\param bw LR-FHSS bandwidth, one of RADIOLIB_LR11X0_LR_FHSS_BW_* values. Defaults to 722.66 kHz.
|
||||
\param cr LR-FHSS coding rate, one of RADIOLIB_LR11X0_LR_FHSS_CR_* values. Defaults to 2/3 coding rate.
|
||||
\param narrowGrid Whether to use narrow (3.9 kHz) or wide (25.39 kHz) grid spacing. Defaults to true (narrow/non-FCC) grid.
|
||||
\param power Output power in dBm. Defaults to 10 dBm.
|
||||
\param tcxoVoltage TCXO reference voltage to be set. Defaults to 1.6 V.
|
||||
If you are seeing -706/-707 error codes, it likely means you are using non-0 value for module with XTAL.
|
||||
To use XTAL, either set this value to 0, or set LR11x0::XTAL to true.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t beginLRFHSS(float freq = 434.0, uint8_t bw = RADIOLIB_LR11X0_LR_FHSS_BW_722_66, uint8_t cr = RADIOLIB_LR11X0_LR_FHSS_CR_2_3, int8_t power = 10, float tcxoVoltage = 1.6);
|
||||
int16_t beginLRFHSS(float freq = 434.0, uint8_t bw = RADIOLIB_LR11X0_LR_FHSS_BW_722_66, uint8_t cr = RADIOLIB_LR11X0_LR_FHSS_CR_2_3, bool narrowGrid = true, int8_t power = 10, float tcxoVoltage = 1.6);
|
||||
|
||||
// configuration methods
|
||||
|
||||
|
|
|
@ -98,11 +98,14 @@ int16_t LR11x0::beginGFSK(float br, float freqDev, float rxBw, uint16_t preamble
|
|||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
int16_t LR11x0::beginLRFHSS(uint8_t bw, uint8_t cr, float tcxoVoltage) {
|
||||
int16_t LR11x0::beginLRFHSS(uint8_t bw, uint8_t cr, bool narrowGrid, float tcxoVoltage) {
|
||||
// set module properties and perform initial setup
|
||||
int16_t state = this->modSetup(tcxoVoltage, RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
// set grid spacing
|
||||
this->lrFhssGrid = narrowGrid ? RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_NON_FCC : RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_FCC;
|
||||
|
||||
// configure publicly accessible settings
|
||||
state = setLrFhssConfig(bw, cr);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
@ -418,8 +421,8 @@ int16_t LR11x0::startTransmit(const uint8_t* data, size_t len, uint8_t addr) {
|
|||
|
||||
if(modem == RADIOLIB_LR11X0_PACKET_TYPE_LR_FHSS) {
|
||||
// in LR-FHSS mode, the packet is built by the device
|
||||
// TODO add configurable grid step and device offset
|
||||
state = lrFhssBuildFrame(this->lrFhssHdrCount, this->lrFhssCr, RADIOLIB_LR11X0_LR_FHSS_GRID_STEP_FCC, true, this->lrFhssBw, this->lrFhssHopSeq, 0, const_cast<uint8_t*>(data), len);
|
||||
// TODO add configurable device offset
|
||||
state = lrFhssBuildFrame(this->lrFhssHdrCount, this->lrFhssCr, this->lrFhssGrid, true, this->lrFhssBw, this->lrFhssHopSeq, 0, const_cast<uint8_t*>(data), len);
|
||||
RADIOLIB_ASSERT(state);
|
||||
|
||||
} else {
|
||||
|
|
|
@ -796,10 +796,11 @@ class LR11x0: public PhysicalLayer {
|
|||
\brief Initialization method for LR-FHSS modem.
|
||||
\param bw LR-FHSS bandwidth, one of RADIOLIB_LR11X0_LR_FHSS_BW_* values.
|
||||
\param cr LR-FHSS coding rate, one of RADIOLIB_LR11X0_LR_FHSS_CR_* values.
|
||||
\param narrowGrid Whether to use narrow (3.9 kHz) or wide (25.39 kHz) grid spacing.
|
||||
\param tcxoVoltage TCXO reference voltage to be set.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t beginLRFHSS(uint8_t bw, uint8_t cr, float tcxoVoltage);
|
||||
int16_t beginLRFHSS(uint8_t bw, uint8_t cr, bool narrowGrid, float tcxoVoltage);
|
||||
|
||||
/*!
|
||||
\brief Reset method. Will reset the chip to the default state using RST pin.
|
||||
|
@ -1594,7 +1595,7 @@ class LR11x0: public PhysicalLayer {
|
|||
uint16_t preambleLengthGFSK = 0;
|
||||
|
||||
// cached LR-FHSS parameters
|
||||
uint8_t lrFhssCr = 0, lrFhssBw = 0, lrFhssHdrCount = 0;
|
||||
uint8_t lrFhssCr = 0, lrFhssBw = 0, lrFhssHdrCount = 0, lrFhssGrid = 0;
|
||||
uint16_t lrFhssHopSeq = 0;
|
||||
|
||||
float dataRateMeasured = 0;
|
||||
|
|
|
@ -62,6 +62,9 @@ struct LrFhssRate_t {
|
|||
|
||||
/*! \brief Coding rate */
|
||||
uint8_t cr;
|
||||
|
||||
/*! \brief Grid spacing */
|
||||
bool narrowGrid;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -74,6 +77,9 @@ union DataRate_t {
|
|||
|
||||
/*! \brief Interpretation for FSK modems */
|
||||
FSKRate_t fsk;
|
||||
|
||||
/*! \brief Interpretation for LR-FHSS modems */
|
||||
LrFhssRate_t lrFhss;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
Ładowanie…
Reference in New Issue