[LR11x0] Added direct mode support

pull/1075/head
jgromes 2024-04-20 18:05:31 +02:00
rodzic 6fa4aa3ebb
commit 99d2e6c452
6 zmienionych plików z 43 dodań i 2 usunięć

Wyświetl plik

@ -8,6 +8,7 @@
- SX127x/RFM9x - SX127x/RFM9x
- SX126x/LLCC68 - SX126x/LLCC68
- SX128x - SX128x
- LR11x0
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration

Wyświetl plik

@ -12,6 +12,7 @@
- SX126x - SX126x
- nRF24 - nRF24
- Si443x/RFM2x - Si443x/RFM2x
- LR11x0
Using raw AX.25 frames requires some Using raw AX.25 frames requires some
knowledge of the protocol, refer to knowledge of the protocol, refer to

Wyświetl plik

@ -12,6 +12,7 @@
- SX126x - SX126x
- nRF24 - nRF24
- Si443x/RFM2x - Si443x/RFM2x
- LR11x0
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration

Wyświetl plik

@ -14,6 +14,7 @@
- nRF24 - nRF24
- Si443x/RFM2x - Si443x/RFM2x
- SX128x - SX128x
- LR11x0
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration https://github.com/jgromes/RadioLib/wiki/Default-configuration

Wyświetl plik

@ -292,6 +292,29 @@ int16_t LR11x0::receive(uint8_t* data, size_t len) {
return(readData(data, len)); return(readData(data, len));
} }
int16_t LR11x0::transmitDirect(uint32_t frf) {
// set RF switch (if present)
this->mod->setRfSwitchState(Module::MODE_TX);
// user requested to start transmitting immediately (required for RTTY)
int16_t state = RADIOLIB_ERR_NONE;
if(frf != 0) {
state = setRfFrequency(frf);
}
RADIOLIB_ASSERT(state);
// start transmitting
return(setTxCw());
}
int16_t LR11x0::receiveDirect() {
// set RF switch (if present)
this->mod->setRfSwitchState(Module::MODE_RX);
// LR11x0 is unable to output received data directly
return(RADIOLIB_ERR_UNKNOWN);
}
int16_t LR11x0::standby() { int16_t LR11x0::standby() {
return(LR11x0::standby(RADIOLIB_LR11X0_STANDBY_RC)); return(LR11x0::standby(RADIOLIB_LR11X0_STANDBY_RC));
} }
@ -643,7 +666,7 @@ int16_t LR11x0::setFrequencyDeviation(float freqDev) {
} }
RADIOLIB_CHECK_RANGE(newFreqDev, 0.6, 200.0, RADIOLIB_ERR_INVALID_FREQUENCY_DEVIATION); RADIOLIB_CHECK_RANGE(newFreqDev, 0.6, 200.0, RADIOLIB_ERR_INVALID_FREQUENCY_DEVIATION);
this->frequencyDev = freqDev * 1000.0; this->frequencyDev = newFreqDev * 1000.0;
return(setModulationParamsGFSK(this->bitRate, this->pulseShape, this->rxBandwidth, this->frequencyDev)); return(setModulationParamsGFSK(this->bitRate, this->pulseShape, this->rxBandwidth, this->frequencyDev));
} }

Wyświetl plik

@ -10,7 +10,7 @@
#include "../../protocols/PhysicalLayer/PhysicalLayer.h" #include "../../protocols/PhysicalLayer/PhysicalLayer.h"
// LR11X0 physical layer properties // LR11X0 physical layer properties
#define RADIOLIB_LR11X0_FREQUENCY_STEP_SIZE 0.9536743164 #define RADIOLIB_LR11X0_FREQUENCY_STEP_SIZE 1.0
#define RADIOLIB_LR11X0_MAX_PACKET_LENGTH 255 #define RADIOLIB_LR11X0_MAX_PACKET_LENGTH 255
#define RADIOLIB_LR11X0_CRYSTAL_FREQ 32.0 #define RADIOLIB_LR11X0_CRYSTAL_FREQ 32.0
#define RADIOLIB_LR11X0_DIV_EXPONENT 25 #define RADIOLIB_LR11X0_DIV_EXPONENT 25
@ -606,6 +606,20 @@ class LR11x0: public PhysicalLayer {
*/ */
int16_t receive(uint8_t* data, size_t len) override; int16_t receive(uint8_t* data, size_t len) override;
/*!
\brief Starts direct mode transmission.
\param frf Raw RF frequency value. Defaults to 0, required for quick frequency shifts in RTTY.
\returns \ref status_codes
*/
int16_t transmitDirect(uint32_t frf = 0) override;
/*!
\brief Starts direct mode reception. Only implemented for PhysicalLayer compatibility, as %SX126x series does not support direct mode reception.
Will always return RADIOLIB_ERR_UNKNOWN.
\returns \ref status_codes
*/
int16_t receiveDirect() override;
/*! /*!
\brief Sets the module to standby mode (overload for PhysicalLayer compatibility, uses 13 MHz RC oscillator). \brief Sets the module to standby mode (overload for PhysicalLayer compatibility, uses 13 MHz RC oscillator).
\returns \ref status_codes \returns \ref status_codes