[MOD] Increase maximum number of RF switch pins to 5

pull/1155/head
jgromes 2024-05-26 16:36:42 +02:00
rodzic 852d336c50
commit f78b3ccc97
8 zmienionych plików z 10 dodań i 10 usunięć

Wyświetl plik

@ -24,7 +24,7 @@ STM32WLx radio = new STM32WLx_Module();
// Some boards may not have either LP or HP. // Some boards may not have either LP or HP.
// For those, do not set the LP/HP entry in the table. // For those, do not set the LP/HP entry in the table.
static const uint32_t rfswitch_pins[] = static const uint32_t rfswitch_pins[] =
{PC3, PC4, PC5}; {PC3, PC4, PC5, RADIOLIB_NC, RADIOLIB_NC};
static const Module::RfSwitchMode_t rfswitch_table[] = { static const Module::RfSwitchMode_t rfswitch_table[] = {
{STM32WLx::MODE_IDLE, {LOW, LOW, LOW}}, {STM32WLx::MODE_IDLE, {LOW, LOW, LOW}},
{STM32WLx::MODE_RX, {HIGH, HIGH, LOW}}, {STM32WLx::MODE_RX, {HIGH, HIGH, LOW}},

Wyświetl plik

@ -24,7 +24,7 @@ STM32WLx radio = new STM32WLx_Module();
// Some boards may not have either LP or HP. // Some boards may not have either LP or HP.
// For those, do not set the LP/HP entry in the table. // For those, do not set the LP/HP entry in the table.
static const uint32_t rfswitch_pins[] = static const uint32_t rfswitch_pins[] =
{PC3, PC4, PC5}; {PC3, PC4, PC5, RADIOLIB_NC, RADIOLIB_NC};
static const Module::RfSwitchMode_t rfswitch_table[] = { static const Module::RfSwitchMode_t rfswitch_table[] = {
{STM32WLx::MODE_IDLE, {LOW, LOW, LOW}}, {STM32WLx::MODE_IDLE, {LOW, LOW, LOW}},
{STM32WLx::MODE_RX, {HIGH, HIGH, LOW}}, {STM32WLx::MODE_RX, {HIGH, HIGH, LOW}},

Wyświetl plik

@ -40,7 +40,7 @@ STM32WLx radio = new STM32WLx_Module();
// Some boards may not have either LP or HP. // Some boards may not have either LP or HP.
// For those, do not set the LP/HP entry in the table. // For those, do not set the LP/HP entry in the table.
static const uint32_t rfswitch_pins[] = static const uint32_t rfswitch_pins[] =
{PC3, PC4, PC5}; {PC3, PC4, PC5, RADIOLIB_NC, RADIOLIB_NC};
static const Module::RfSwitchMode_t rfswitch_table[] = { static const Module::RfSwitchMode_t rfswitch_table[] = {
{STM32WLx::MODE_IDLE, {LOW, LOW, LOW}}, {STM32WLx::MODE_IDLE, {LOW, LOW, LOW}},
{STM32WLx::MODE_RX, {HIGH, HIGH, LOW}}, {STM32WLx::MODE_RX, {HIGH, HIGH, LOW}},

Wyświetl plik

@ -34,7 +34,7 @@ STM32WLx radio = new STM32WLx_Module();
// Some boards may not have either LP or HP. // Some boards may not have either LP or HP.
// For those, do not set the LP/HP entry in the table. // For those, do not set the LP/HP entry in the table.
static const uint32_t rfswitch_pins[] = static const uint32_t rfswitch_pins[] =
{PC3, PC4, PC5}; {PC3, PC4, PC5, RADIOLIB_NC, RADIOLIB_NC};
static const Module::RfSwitchMode_t rfswitch_table[] = { static const Module::RfSwitchMode_t rfswitch_table[] = {
{STM32WLx::MODE_IDLE, {LOW, LOW, LOW}}, {STM32WLx::MODE_IDLE, {LOW, LOW, LOW}},
{STM32WLx::MODE_RX, {HIGH, HIGH, LOW}}, {STM32WLx::MODE_RX, {HIGH, HIGH, LOW}},

Wyświetl plik

@ -35,7 +35,7 @@ STM32WLx radio = new STM32WLx_Module();
// Some boards may not have either LP or HP. // Some boards may not have either LP or HP.
// For those, do not set the LP/HP entry in the table. // For those, do not set the LP/HP entry in the table.
static const uint32_t rfswitch_pins[] = static const uint32_t rfswitch_pins[] =
{PC3, PC4, PC5}; {PC3, PC4, PC5, RADIOLIB_NC, RADIOLIB_NC};
static const Module::RfSwitchMode_t rfswitch_table[] = { static const Module::RfSwitchMode_t rfswitch_table[] = {
{STM32WLx::MODE_IDLE, {LOW, LOW, LOW}}, {STM32WLx::MODE_IDLE, {LOW, LOW, LOW}},
{STM32WLx::MODE_RX, {HIGH, HIGH, LOW}}, {STM32WLx::MODE_RX, {HIGH, HIGH, LOW}},

Wyświetl plik

@ -26,7 +26,7 @@ STM32WLx radio = new STM32WLx_Module();
// Some boards may not have either LP or HP. // Some boards may not have either LP or HP.
// For those, do not set the LP/HP entry in the table. // For those, do not set the LP/HP entry in the table.
static const uint32_t rfswitch_pins[] = static const uint32_t rfswitch_pins[] =
{PC3, PC4, PC5}; {PC3, PC4, PC5, RADIOLIB_NC, RADIOLIB_NC};
static const Module::RfSwitchMode_t rfswitch_table[] = { static const Module::RfSwitchMode_t rfswitch_table[] = {
{STM32WLx::MODE_IDLE, {LOW, LOW, LOW}}, {STM32WLx::MODE_IDLE, {LOW, LOW, LOW}},
{STM32WLx::MODE_RX, {HIGH, HIGH, LOW}}, {STM32WLx::MODE_RX, {HIGH, HIGH, LOW}},

Wyświetl plik

@ -565,7 +565,7 @@ size_t Module::serialPrintf(const char* format, ...) {
void Module::setRfSwitchPins(uint32_t rxEn, uint32_t txEn) { void Module::setRfSwitchPins(uint32_t rxEn, uint32_t txEn) {
// This can be on the stack, setRfSwitchTable copies the contents // This can be on the stack, setRfSwitchTable copies the contents
const uint32_t pins[] = { const uint32_t pins[] = {
rxEn, txEn, RADIOLIB_NC, rxEn, txEn, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC,
}; };
// This must be static, since setRfSwitchTable stores a reference. // This must be static, since setRfSwitchTable stores a reference.
@ -578,7 +578,7 @@ void Module::setRfSwitchPins(uint32_t rxEn, uint32_t txEn) {
setRfSwitchTable(pins, table); setRfSwitchTable(pins, table);
} }
void Module::setRfSwitchTable(const uint32_t (&pins)[3], const RfSwitchMode_t table[]) { void Module::setRfSwitchTable(const uint32_t (&pins)[RFSWITCH_MAX_PINS], const RfSwitchMode_t table[]) {
memcpy(this->rfSwitchPins, pins, sizeof(this->rfSwitchPins)); memcpy(this->rfSwitchPins, pins, sizeof(this->rfSwitchPins));
this->rfSwitchTable = table; this->rfSwitchTable = table;
for(size_t i = 0; i < RFSWITCH_MAX_PINS; i++) for(size_t i = 0; i < RFSWITCH_MAX_PINS; i++)

Wyświetl plik

@ -71,7 +71,7 @@ class Module {
value is ever increased and such an array gets extra zero value is ever increased and such an array gets extra zero
elements (that will be interpreted as pin 0). elements (that will be interpreted as pin 0).
*/ */
static const size_t RFSWITCH_MAX_PINS = 3; static const size_t RFSWITCH_MAX_PINS = 5;
/*! /*!
\struct RfSwitchMode_t \struct RfSwitchMode_t
@ -546,7 +546,7 @@ class Module {
uint32_t gpioPin = RADIOLIB_NC; uint32_t gpioPin = RADIOLIB_NC;
// RF switch pins and table // RF switch pins and table
uint32_t rfSwitchPins[RFSWITCH_MAX_PINS] = { RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC }; uint32_t rfSwitchPins[RFSWITCH_MAX_PINS] = { RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC, RADIOLIB_NC };
const RfSwitchMode_t *rfSwitchTable = nullptr; const RfSwitchMode_t *rfSwitchTable = nullptr;
#if RADIOLIB_INTERRUPT_TIMING #if RADIOLIB_INTERRUPT_TIMING