kopia lustrzana https://github.com/jgromes/RadioLib
[SX128x] Add LoRa Rx header infos method
rodzic
72873b4a97
commit
ab8043ac4e
|
@ -1286,6 +1286,20 @@ size_t SX128x::getPacketLength(bool update, uint8_t* offset) {
|
||||||
return((size_t)rxBufStatus[0]);
|
return((size_t)rxBufStatus[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int16_t SX128x::getLoRaRxHeaderInfo(uint8_t* cr, bool* hasCRC) {
|
||||||
|
int16_t state = RADIOLIB_ERR_NONE;
|
||||||
|
|
||||||
|
// check if in explicit header mode
|
||||||
|
if(this->headerType == RADIOLIB_SX128X_LORA_HEADER_IMPLICIT) {
|
||||||
|
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(cr) { *cr = this->mod->SPIgetRegValue(RADIOLIB_SX128X_REG_LORA_RX_CODING_RATE, 6, 4) >> 4; }
|
||||||
|
if(hasCRC) { *hasCRC = (this->mod->SPIgetRegValue(RADIOLIB_SX128X_REG_FEI_MSB, 4, 4) != 0); }
|
||||||
|
|
||||||
|
return(state);
|
||||||
|
}
|
||||||
|
|
||||||
int16_t SX128x::fixedPacketLengthMode(uint8_t len) {
|
int16_t SX128x::fixedPacketLengthMode(uint8_t len) {
|
||||||
return(setPacketMode(RADIOLIB_SX128X_GFSK_FLRC_PACKET_FIXED, len));
|
return(setPacketMode(RADIOLIB_SX128X_GFSK_FLRC_PACKET_FIXED, len));
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@
|
||||||
#define RADIOLIB_SX128X_REG_FREQ_ERROR_CORRECTION 0x093C
|
#define RADIOLIB_SX128X_REG_FREQ_ERROR_CORRECTION 0x093C
|
||||||
#define RADIOLIB_SX128X_REG_LORA_SYNC_WORD_MSB 0x0944
|
#define RADIOLIB_SX128X_REG_LORA_SYNC_WORD_MSB 0x0944
|
||||||
#define RADIOLIB_SX128X_REG_LORA_SYNC_WORD_LSB 0x0945
|
#define RADIOLIB_SX128X_REG_LORA_SYNC_WORD_LSB 0x0945
|
||||||
|
#define RADIOLIB_SX128X_REG_LORA_RX_CODING_RATE 0x0950
|
||||||
#define RADIOLIB_SX128X_REG_RANGING_FILTER_RSSI_OFFSET 0x0953
|
#define RADIOLIB_SX128X_REG_RANGING_FILTER_RSSI_OFFSET 0x0953
|
||||||
#define RADIOLIB_SX128X_REG_FEI_MSB 0x0954
|
#define RADIOLIB_SX128X_REG_FEI_MSB 0x0954
|
||||||
#define RADIOLIB_SX128X_REG_FEI_MID 0x0955
|
#define RADIOLIB_SX128X_REG_FEI_MID 0x0955
|
||||||
|
@ -795,6 +796,14 @@ class SX128x: public PhysicalLayer {
|
||||||
*/
|
*/
|
||||||
size_t getPacketLength(bool update, uint8_t* offset);
|
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 Set modem in fixed packet length mode. Available in GFSK mode only.
|
\brief Set modem in fixed packet length mode. Available in GFSK mode only.
|
||||||
\param len Packet length.
|
\param len Packet length.
|
||||||
|
|
Ładowanie…
Reference in New Issue