[LR11x0] Implemented RF switch control

This commit is contained in:
jgromes 2024-05-26 17:03:45 +02:00
parent 3af427fefb
commit a465f64969
12 changed files with 320 additions and 78 deletions

View file

@ -7,6 +7,10 @@
of LoRa transmission, not just the preamble. of LoRa transmission, not just the preamble.
Other modules from LR11x0 family can also be used. Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
Using blocking CAD is not recommended, as it will lead Using blocking CAD is not recommended, as it will lead
to significant amount of timeouts, inefficient use of processor to significant amount of timeouts, inefficient use of processor
@ -30,13 +34,34 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // set RF switch configuration for Wio WM1110
// https://github.com/jgromes/RadioShield // Wio WM1110 uses DIO5, 6, 7 and 8 for RF switching
//LR1110 radio = RadioShield.ModuleA; // NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_LR11X0_DIO7, RADIOLIB_LR11X0_DIO8,
RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6 DIO7 DIO8
{ LR11x0::MODE_STBY, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW, LOW, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HF, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW, HIGH, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW, LOW, HIGH } },
END_OF_MODE_TABLE,
};
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();

View file

@ -1,18 +1,22 @@
/* /*
RadioLib LR11x0 Channel Activity Detection Example RadioLib LR11x0 Channel Activity Detection Example
This example uses LR1110 to scan the current LoRa This example uses LR1110 to scan the current LoRa
channel and detect ongoing LoRa transmissions. channel and detect ongoing LoRa transmissions.
Unlike SX127x CAD, LR11x0 can detect any part Unlike SX127x CAD, LR11x0 can detect any part
of LoRa transmission, not just the preamble. of LoRa transmission, not just the preamble.
Other modules from LR11x0 family can also be used. Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
// include the library // include the library
@ -25,13 +29,34 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // set RF switch configuration for Wio WM1110
// https://github.com/jgromes/RadioShield // Wio WM1110 uses DIO5, 6, 7 and 8 for RF switching
//LR1110 radio = RadioShield.ModuleA; // NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_LR11X0_DIO7, RADIOLIB_LR11X0_DIO8,
RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6 DIO7 DIO8
{ LR11x0::MODE_STBY, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW, LOW, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HF, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW, HIGH, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW, LOW, HIGH } },
END_OF_MODE_TABLE,
};
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();

View file

@ -1,19 +1,19 @@
/* /*
RadioLib LR11x0 GFSK Modem Example RadioLib LR11x0 GFSK Modem Example
This example shows how to use GFSK modem in LR11x0 chips. This example shows how to use GFSK modem in LR11x0 chips.
NOTE: The sketch below is just a guide on how to use NOTE: The sketch below is just a guide on how to use
GFSK modem, so this code should not be run directly! GFSK modem, so this code should not be run directly!
Instead, modify the other examples to use GFSK Instead, modify the other examples to use GFSK
modem and use the appropriate configuration modem and use the appropriate configuration
methods. methods.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---gfsk-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---gfsk-modem
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
// include the library // include the library

View file

@ -1,19 +1,19 @@
/* /*
RadioLib LR11x0 LR-FHSS Modem Example RadioLib LR11x0 LR-FHSS Modem Example
This example shows how to use LR-FHSS modem in LR11x0 chips. This example shows how to use LR-FHSS modem in LR11x0 chips.
NOTE: The sketch below is just a guide on how to use NOTE: The sketch below is just a guide on how to use
LR-FHSS modem, so this code should not be run directly! LR-FHSS modem, so this code should not be run directly!
Instead, modify the other examples to use LR-FHSS Instead, modify the other examples to use LR-FHSS
modem and use the appropriate configuration modem and use the appropriate configuration
methods. methods.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lr-fhss-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lr-fhss-modem
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
// include the library // include the library

View file

@ -12,6 +12,10 @@
- preamble length - preamble length
Other modules from LR11x0 family can also be used. Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
Using blocking receive is not recommended, as it will lead Using blocking receive is not recommended, as it will lead
to significant amount of timeouts, inefficient use of processor to significant amount of timeouts, inefficient use of processor
@ -35,13 +39,34 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // set RF switch configuration for Wio WM1110
// https://github.com/jgromes/RadioShield // Wio WM1110 uses DIO5, 6, 7 and 8 for RF switching
//LR1110 radio = RadioShield.ModuleA; // NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_LR11X0_DIO7, RADIOLIB_LR11X0_DIO8,
RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6 DIO7 DIO8
{ LR11x0::MODE_STBY, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW, LOW, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HF, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW, HIGH, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW, LOW, HIGH } },
END_OF_MODE_TABLE,
};
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();

View file

@ -1,24 +1,28 @@
/* /*
RadioLib LR11x0 Receive with Interrupts Example RadioLib LR11x0 Receive with Interrupts Example
This example listens for LoRa transmissions and tries to This example listens for LoRa transmissions and tries to
receive them. Once a packet is received, an interrupt is receive them. Once a packet is received, an interrupt is
triggered. To successfully receive data, the following triggered. To successfully receive data, the following
settings have to be the same on both transmitter settings have to be the same on both transmitter
and receiver: and receiver:
- carrier frequency - carrier frequency
- bandwidth - bandwidth
- spreading factor - spreading factor
- coding rate - coding rate
- sync word - sync word
Other modules from LR11x0 family can also be used. Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem
For full API reference, see the GitHub Pages For full API reference, see the GitHub Pages
https://jgromes.github.io/RadioLib/ https://jgromes.github.io/RadioLib/
*/ */
// include the library // include the library
@ -31,13 +35,34 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // set RF switch configuration for Wio WM1110
// https://github.com/jgromes/RadioShield // Wio WM1110 uses DIO5, 6, 7 and 8 for RF switching
//LR1110 radio = RadioShield.ModuleA; // NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_LR11X0_DIO7, RADIOLIB_LR11X0_DIO8,
RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6 DIO7 DIO8
{ LR11x0::MODE_STBY, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW, LOW, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HF, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW, HIGH, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW, LOW, HIGH } },
END_OF_MODE_TABLE,
};
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();

View file

@ -8,6 +8,10 @@
- arbitrary binary data (byte array) - arbitrary binary data (byte array)
Other modules from LR11x0 family can also be used. Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem
@ -26,13 +30,34 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // set RF switch configuration for Wio WM1110
// https://github.com/jgromes/RadioShield // Wio WM1110 uses DIO5, 6, 7 and 8 for RF switching
//LR1110 radio = RadioShield.ModuleA; // NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_LR11X0_DIO7, RADIOLIB_LR11X0_DIO8,
RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6 DIO7 DIO8
{ LR11x0::MODE_STBY, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW, LOW, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HF, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW, HIGH, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW, LOW, HIGH } },
END_OF_MODE_TABLE,
};
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();
@ -44,17 +69,6 @@ void setup() {
delay(1000); delay(1000);
while (true); while (true);
} }
// some modules have an external RF switch
// controlled via two pins (RX enable, TX enable)
// to enable automatic control of the switch,
// call the following method
// RX enable: 4
// TX enable: 5
/*
radio.setRfSwitchPins(4, 5);
*/
} }
// counter to keep track of transmitted packets // counter to keep track of transmitted packets

View file

@ -9,6 +9,10 @@
- arbitrary binary data (byte array) - arbitrary binary data (byte array)
Other modules from LR11x0 family can also be used. Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
For default module settings, see the wiki page For default module settings, see the wiki page
https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem https://github.com/jgromes/RadioLib/wiki/Default-configuration#lr11x0---lora-modem
@ -27,9 +31,26 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // set RF switch configuration for Wio WM1110
// https://github.com/jgromes/RadioShield // Wio WM1110 uses DIO5, 6, 7 and 8 for RF switching
//LR1110 radio = RadioShield.ModuleA; // NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_LR11X0_DIO7, RADIOLIB_LR11X0_DIO8,
RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6 DIO7 DIO8
{ LR11x0::MODE_STBY, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW, LOW, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HF, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW, HIGH, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW, LOW, HIGH } },
END_OF_MODE_TABLE,
};
// save transmission state between loops // save transmission state between loops
int transmissionState = RADIOLIB_ERR_NONE; int transmissionState = RADIOLIB_ERR_NONE;
@ -37,6 +58,10 @@ int transmissionState = RADIOLIB_ERR_NONE;
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();

View file

@ -6,6 +6,10 @@
such as the frequency, country code and SSID. such as the frequency, country code and SSID.
Other modules from LR11x0 family can also be used. Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
Using blocking scan is not recommended, as depending Using blocking scan is not recommended, as depending
on the scan settings, the program may be blocked on the scan settings, the program may be blocked
@ -28,13 +32,34 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // set RF switch configuration for Wio WM1110
// https://github.com/jgromes/RadioShield // Wio WM1110 uses DIO5, 6, 7 and 8 for RF switching
//LR1110 radio = RadioShield.ModuleA; // NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_LR11X0_DIO7, RADIOLIB_LR11X0_DIO8,
RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6 DIO7 DIO8
{ LR11x0::MODE_STBY, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW, LOW, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HF, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW, HIGH, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW, LOW, HIGH } },
END_OF_MODE_TABLE,
};
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();

View file

@ -6,6 +6,10 @@
such as the frequency, country code and SSID. such as the frequency, country code and SSID.
Other modules from LR11x0 family can also be used. Other modules from LR11x0 family can also be used.
This example assumes Seeed Studio Wio WM1110 is used.
For other LR11x0 modules, some configuration such as
RF switch control may have to be adjusted.
Using blocking scan is not recommended, as depending Using blocking scan is not recommended, as depending
on the scan settings, the program may be blocked on the scan settings, the program may be blocked
@ -28,13 +32,34 @@
// BUSY pin: 9 // BUSY pin: 9
LR1110 radio = new Module(10, 2, 3, 9); LR1110 radio = new Module(10, 2, 3, 9);
// or using RadioShield // set RF switch configuration for Wio WM1110
// https://github.com/jgromes/RadioShield // Wio WM1110 uses DIO5, 6, 7 and 8 for RF switching
//LR1110 radio = RadioShield.ModuleA; // NOTE: other boards may be different!
static const uint32_t rfswitch_dio_pins[] = {
RADIOLIB_LR11X0_DIO5, RADIOLIB_LR11X0_DIO6,
RADIOLIB_LR11X0_DIO7, RADIOLIB_LR11X0_DIO8,
RADIOLIB_NC
};
static const Module::RfSwitchMode_t rfswitch_table[] = {
// mode DIO5 DIO6 DIO7 DIO8
{ LR11x0::MODE_STBY, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_RX, { HIGH, LOW, LOW, LOW } },
{ LR11x0::MODE_TX, { HIGH, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HP, { LOW, HIGH, LOW, LOW } },
{ LR11x0::MODE_TX_HF, { LOW, LOW, LOW, LOW } },
{ LR11x0::MODE_GNSS, { LOW, LOW, HIGH, LOW } },
{ LR11x0::MODE_WIFI, { LOW, LOW, LOW, HIGH } },
END_OF_MODE_TABLE,
};
void setup() { void setup() {
Serial.begin(9600); Serial.begin(9600);
// set RF switch control configuration
// this has to be done prior to calling begin()
radio.setRfSwitchTable(rfswitch_dio_pins, rfswitch_table);
// initialize LR1110 with default settings // initialize LR1110 with default settings
Serial.print(F("[LR1110] Initializing ... ")); Serial.print(F("[LR1110] Initializing ... "));
int state = radio.begin(); int state = radio.begin();

View file

@ -1385,6 +1385,28 @@ int16_t LR11x0::setRxBoostedGainMode(bool en) {
return(this->SPIcommand(RADIOLIB_LR11X0_CMD_SET_RX_BOOSTED, true, buff, sizeof(buff))); return(this->SPIcommand(RADIOLIB_LR11X0_CMD_SET_RX_BOOSTED, true, buff, sizeof(buff)));
} }
void LR11x0::setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]) {
// find which pins are used
uint8_t enable = 0;
for(size_t i = 0; i < Module::RFSWITCH_MAX_PINS; i++) {
if((pins[i] == RADIOLIB_NC) || (pins[i] > RADIOLIB_LR11X0_DIO10)) {
continue;
}
enable |= 1UL << pins[i];
}
// now get the configuration
uint8_t modes[7] = { 0 };
for(size_t i = 0; i < 7; i++) {
for(size_t j = 0; j < Module::RFSWITCH_MAX_PINS; j++) {
modes[i] |= (table[i].values[j] > 0) ? (1UL << j) : 0;
}
}
// set it
this->setDioAsRfSwitch(enable, modes[0], modes[1], modes[2], modes[3], modes[4], modes[5], modes[6]);
}
int16_t LR11x0::setLrFhssConfig(uint8_t bw, uint8_t cr, uint8_t hdrCount, uint16_t hopSeed) { int16_t LR11x0::setLrFhssConfig(uint8_t bw, uint8_t cr, uint8_t hdrCount, uint16_t hopSeed) {
// check active modem // check active modem
uint8_t type = RADIOLIB_LR11X0_PACKET_TYPE_NONE; uint8_t type = RADIOLIB_LR11X0_PACKET_TYPE_NONE;

View file

@ -240,6 +240,11 @@
#define RADIOLIB_LR11X0_RFSW_DIO8_DISABLED (0x00UL << 3) // 4 0 DIO8 disabled (default) #define RADIOLIB_LR11X0_RFSW_DIO8_DISABLED (0x00UL << 3) // 4 0 DIO8 disabled (default)
#define RADIOLIB_LR11X0_RFSW_DIO10_ENABLED (0x01UL << 4) // 4 0 RF switch: DIO10 enabled #define RADIOLIB_LR11X0_RFSW_DIO10_ENABLED (0x01UL << 4) // 4 0 RF switch: DIO10 enabled
#define RADIOLIB_LR11X0_RFSW_DIO10_DISABLED (0x00UL << 4) // 4 0 DIO10 disabled (default) #define RADIOLIB_LR11X0_RFSW_DIO10_DISABLED (0x00UL << 4) // 4 0 DIO10 disabled (default)
#define RADIOLIB_LR11X0_DIO5 (0)
#define RADIOLIB_LR11X0_DIO6 (1)
#define RADIOLIB_LR11X0_DIO7 (2)
#define RADIOLIB_LR11X0_DIO8 (3)
#define RADIOLIB_LR11X0_DIO10 (4)
// RADIOLIB_LR11X0_CMD_SET_DIO_IRQ_PARAMS // RADIOLIB_LR11X0_CMD_SET_DIO_IRQ_PARAMS
#define RADIOLIB_LR11X0_IRQ_TX_DONE (0x01UL << 2) // 31 0 interrupt: packet transmitted #define RADIOLIB_LR11X0_IRQ_TX_DONE (0x01UL << 2) // 31 0 interrupt: packet transmitted
@ -710,6 +715,29 @@ class LR11x0: public PhysicalLayer {
*/ */
explicit LR11x0(Module* mod); explicit LR11x0(Module* mod);
/*!
\brief Custom operation modes for LR11x0.
Needed because LR11x0 has several modems (sub-GHz, 2.4 GHz etc.) in one package
*/
enum OpMode_t {
/*! End of table marker, use \ref END_OF_MODE_TABLE constant instead */
MODE_END_OF_TABLE = Module::MODE_END_OF_TABLE,
/*! Standby/idle mode */
MODE_STBY = Module::MODE_IDLE,
/*! Receive mode */
MODE_RX = Module::MODE_RX,
/*! Low power transmission mode */
MODE_TX = Module::MODE_TX,
/*! High power transmission mode */
MODE_TX_HP,
/*! High frequency transmission mode */
MODE_TX_HF,
/*! GNSS scanning mode */
MODE_GNSS,
/*! WiFi scanning mode */
MODE_WIFI,
};
/*! /*!
\brief Whether the module has an XTAL (true) or TCXO (false). Defaults to false. \brief Whether the module has an XTAL (true) or TCXO (false). Defaults to false.
*/ */
@ -1266,6 +1294,9 @@ class LR11x0: public PhysicalLayer {
*/ */
int16_t setRxBoostedGainMode(bool en); int16_t setRxBoostedGainMode(bool en);
/*! \copydoc Module::setRfSwitchTable */
void setRfSwitchTable(const uint32_t (&pins)[Module::RFSWITCH_MAX_PINS], const Module::RfSwitchMode_t table[]);
/*! /*!
\brief Sets LR-FHSS configuration. \brief Sets LR-FHSS configuration.
\param bw LR-FHSS bandwidth, one of RADIOLIB_LR11X0_LR_FHSS_BW_* values. \param bw LR-FHSS bandwidth, one of RADIOLIB_LR11X0_LR_FHSS_BW_* values.