kopia lustrzana https://github.com/jgromes/RadioLib
[LR11x0] Move Rx header infos to public method
rodzic
a28234e262
commit
28854895b4
|
@ -1354,6 +1354,14 @@ class LR11x0: public PhysicalLayer {
|
|||
*/
|
||||
size_t getPacketLength(bool update, uint8_t* offset);
|
||||
|
||||
/*!
|
||||
\brief Get LoRa header information from last received packet. Only valid in explicit header mode.
|
||||
\param cr Pointer to variable to store the coding rate.
|
||||
\param hasCRC Pointer to variable to store the CRC status.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t getLoRaRxHeaderInfo(uint8_t* cr, bool* hasCRC);
|
||||
|
||||
/*!
|
||||
\brief Get expected time-on-air for a given size of payload
|
||||
\param len Payload length in bytes.
|
||||
|
@ -1712,7 +1720,6 @@ class LR11x0: public PhysicalLayer {
|
|||
int16_t lrFhssBuildFrame(uint8_t hdrCount, uint8_t cr, uint8_t grid, bool hop, uint8_t bw, uint16_t hopSeq, int8_t devOffset, const uint8_t* payload, size_t len);
|
||||
int16_t lrFhssSetSyncWord(uint32_t sync);
|
||||
int16_t configBleBeacon(uint8_t chan, const uint8_t* payload, size_t len);
|
||||
int16_t getLoRaRxHeaderInfos(uint8_t* info);
|
||||
int16_t bleBeaconSend(uint8_t chan, const uint8_t* payload, size_t len);
|
||||
|
||||
int16_t wifiScan(uint8_t type, uint16_t mask, uint8_t acqMode, uint8_t nbMaxRes, uint8_t nbScanPerChan, uint16_t timeout, uint8_t abortOnTimeout);
|
||||
|
|
|
@ -770,12 +770,18 @@ int16_t LR11x0::configBleBeacon(uint8_t chan, const uint8_t* payload, size_t len
|
|||
return(this->bleBeaconCommon(RADIOLIB_LR11X0_CMD_CONFIG_BLE_BEACON, chan, payload, len));
|
||||
}
|
||||
|
||||
int16_t LR11x0::getLoRaRxHeaderInfos(uint8_t* info) {
|
||||
int16_t LR11x0::getLoRaRxHeaderInfo(uint8_t* cr, bool* hasCRC) {
|
||||
// check if in explicit header mode
|
||||
if(this->headerType == RADIOLIB_LR11X0_LORA_HEADER_IMPLICIT) {
|
||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||
}
|
||||
|
||||
uint8_t buff[1] = { 0 };
|
||||
int16_t state = this->SPIcommand(RADIOLIB_LR11X0_CMD_GET_LORA_RX_HEADER_INFOS, false, buff, sizeof(buff));
|
||||
|
||||
// pass the replies
|
||||
if(info) { *info = buff[0]; }
|
||||
if(cr) { *cr = (buff[0] & 0x70) >> 4; }
|
||||
if(hasCRC) { *hasCRC = (buff[0] & RADIOLIB_LR11X0_LAST_HEADER_CRC_ENABLED) != 0; }
|
||||
|
||||
return(state);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue