[LR11x0] Added LoRa header configuration methods
This commit is contained in:
parent
bcd8a05cd4
commit
4f1e5c5521
2 changed files with 42 additions and 0 deletions
|
@ -1310,6 +1310,14 @@ RadioLibTime_t LR11x0::getTimeOnAir(size_t len) {
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16_t LR11x0::implicitHeader(size_t len) {
|
||||||
|
return(this->setHeaderType(RADIOLIB_LR11X0_LORA_HEADER_IMPLICIT, len));
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t LR11x0::explicitHeader() {
|
||||||
|
return(this->setHeaderType(RADIOLIB_LR11X0_LORA_HEADER_EXPLICIT));
|
||||||
|
}
|
||||||
|
|
||||||
float LR11x0::getDataRate() const {
|
float LR11x0::getDataRate() const {
|
||||||
return(this->dataRateMeasured);
|
return(this->dataRateMeasured);
|
||||||
}
|
}
|
||||||
|
@ -1694,6 +1702,26 @@ int16_t LR11x0::startCad(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin) {
|
||||||
return(setCad());
|
return(setCad());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16_t LR11x0::setHeaderType(uint8_t hdrType, size_t len) {
|
||||||
|
// check active modem
|
||||||
|
uint8_t type = RADIOLIB_LR11X0_PACKET_TYPE_NONE;
|
||||||
|
int16_t state = getPacketType(&type);
|
||||||
|
RADIOLIB_ASSERT(state);
|
||||||
|
if(type != RADIOLIB_LR11X0_PACKET_TYPE_LORA) {
|
||||||
|
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set requested packet mode
|
||||||
|
state = setPacketParamsLoRa(this->preambleLengthLoRa, hdrType, len, this->crcTypeLoRa, this->invertIQEnabled);
|
||||||
|
RADIOLIB_ASSERT(state);
|
||||||
|
|
||||||
|
// update cached value
|
||||||
|
this->headerType = hdrType;
|
||||||
|
this->implicitLen = len;
|
||||||
|
|
||||||
|
return(state);
|
||||||
|
}
|
||||||
|
|
||||||
Module* LR11x0::getMod() {
|
Module* LR11x0::getMod() {
|
||||||
return(this->mod);
|
return(this->mod);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1141,6 +1141,19 @@ class LR11x0: public PhysicalLayer {
|
||||||
*/
|
*/
|
||||||
RadioLibTime_t getTimeOnAir(size_t len) override;
|
RadioLibTime_t getTimeOnAir(size_t len) override;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Set implicit header mode for future reception/transmission.
|
||||||
|
\param len Payload length in bytes.
|
||||||
|
\returns \ref status_codes
|
||||||
|
*/
|
||||||
|
int16_t implicitHeader(size_t len);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Set explicit header mode for future reception/transmission.
|
||||||
|
\returns \ref status_codes
|
||||||
|
*/
|
||||||
|
int16_t explicitHeader();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Gets effective data rate for the last transmitted packet. The value is calculated only for payload bytes.
|
\brief Gets effective data rate for the last transmitted packet. The value is calculated only for payload bytes.
|
||||||
\returns Effective data rate in bps.
|
\returns Effective data rate in bps.
|
||||||
|
@ -1404,6 +1417,7 @@ class LR11x0: public PhysicalLayer {
|
||||||
int16_t config(uint8_t modem);
|
int16_t config(uint8_t modem);
|
||||||
int16_t setPacketMode(uint8_t mode, uint8_t len);
|
int16_t setPacketMode(uint8_t mode, uint8_t len);
|
||||||
int16_t startCad(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin);
|
int16_t startCad(uint8_t symbolNum, uint8_t detPeak, uint8_t detMin);
|
||||||
|
int16_t setHeaderType(uint8_t hdrType, size_t len = 0xFF);
|
||||||
|
|
||||||
// common methods to avoid some copy-paste
|
// common methods to avoid some copy-paste
|
||||||
int16_t bleBeaconCommon(uint16_t cmd, uint8_t chan, uint8_t* payload, size_t len);
|
int16_t bleBeaconCommon(uint16_t cmd, uint8_t chan, uint8_t* payload, size_t len);
|
||||||
|
|
Loading…
Add table
Reference in a new issue