[SX126x] Implement getModem
This commit is contained in:
parent
e40fc3830b
commit
fc695540b0
2 changed files with 28 additions and 0 deletions
|
@ -1662,6 +1662,27 @@ int16_t SX126x::invertIQ(bool enable) {
|
|||
return(setPacketParams(this->preambleLengthLoRa, this->crcTypeLoRa, this->implicitLen, this->headerType, this->invertIQEnabled));
|
||||
}
|
||||
|
||||
int16_t SX126x::getModem(ModemType_t* modem) {
|
||||
if(!modem) {
|
||||
return(RADIOLIB_ERR_MEMORY_ALLOCATION_FAILED);
|
||||
}
|
||||
|
||||
uint8_t packetType = getPacketType();
|
||||
switch(packetType) {
|
||||
case(RADIOLIB_SX126X_PACKET_TYPE_LORA):
|
||||
*modem = ModemType_t::LoRa;
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
case(RADIOLIB_SX126X_PACKET_TYPE_GFSK):
|
||||
*modem = ModemType_t::FSK;
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
case(RADIOLIB_SX126X_PACKET_TYPE_LR_FHSS):
|
||||
*modem = ModemType_t::LRFHSS;
|
||||
return(RADIOLIB_ERR_NONE);
|
||||
}
|
||||
|
||||
return(RADIOLIB_ERR_WRONG_MODEM);
|
||||
}
|
||||
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
void SX126x::setDirectAction(void (*func)(void)) {
|
||||
setDio1Action(func);
|
||||
|
|
|
@ -1123,6 +1123,13 @@ class SX126x: public PhysicalLayer {
|
|||
*/
|
||||
int16_t invertIQ(bool enable) override;
|
||||
|
||||
/*!
|
||||
\brief Get modem currently in use by the radio.
|
||||
\param modem Pointer to a variable to save the retrieved configuration into.
|
||||
\returns \ref status_codes
|
||||
*/
|
||||
int16_t getModem(ModemType_t* modem) override;
|
||||
|
||||
#if !RADIOLIB_EXCLUDE_DIRECT_RECEIVE
|
||||
/*!
|
||||
\brief Set interrupt service routine function to call when data bit is received in direct mode.
|
||||
|
|
Loading…
Add table
Reference in a new issue