diff --git a/examples/STM32WLx/STM32WLx_Channel_Activity_Detection/STM32WLx_Channel_Activity_Detection.ino b/examples/STM32WLx/STM32WLx_Channel_Activity_Detection/STM32WLx_Channel_Activity_Detection.ino index da070782..7beab1ee 100644 --- a/examples/STM32WLx/STM32WLx_Channel_Activity_Detection/STM32WLx_Channel_Activity_Detection.ino +++ b/examples/STM32WLx/STM32WLx_Channel_Activity_Detection/STM32WLx_Channel_Activity_Detection.ino @@ -24,7 +24,7 @@ STM32WLx radio = new STM32WLx_Module(); // Some boards may not have either LP or HP. // For those, do not set the LP/HP entry in the table. static const uint32_t rfswitch_pins[] = - {PC3, PC4, PC5}; + {PC3, PC4, PC5, RADIOLIB_NC, RADIOLIB_NC}; static const Module::RfSwitchMode_t rfswitch_table[] = { {STM32WLx::MODE_IDLE, {LOW, LOW, LOW}}, {STM32WLx::MODE_RX, {HIGH, HIGH, LOW}}, diff --git a/examples/STM32WLx/STM32WLx_Channel_Activity_Detection_Interrupt/STM32WLx_Channel_Activity_Detection_Interrupt.ino b/examples/STM32WLx/STM32WLx_Channel_Activity_Detection_Interrupt/STM32WLx_Channel_Activity_Detection_Interrupt.ino index 9c14329d..d730734f 100644 --- a/examples/STM32WLx/STM32WLx_Channel_Activity_Detection_Interrupt/STM32WLx_Channel_Activity_Detection_Interrupt.ino +++ b/examples/STM32WLx/STM32WLx_Channel_Activity_Detection_Interrupt/STM32WLx_Channel_Activity_Detection_Interrupt.ino @@ -24,7 +24,7 @@ STM32WLx radio = new STM32WLx_Module(); // Some boards may not have either LP or HP. // For those, do not set the LP/HP entry in the table. static const uint32_t rfswitch_pins[] = - {PC3, PC4, PC5}; + {PC3, PC4, PC5, RADIOLIB_NC, RADIOLIB_NC}; static const Module::RfSwitchMode_t rfswitch_table[] = { {STM32WLx::MODE_IDLE, {LOW, LOW, LOW}}, {STM32WLx::MODE_RX, {HIGH, HIGH, LOW}}, diff --git a/examples/STM32WLx/STM32WLx_Receive_Blocking/STM32WLx_Receive_Blocking.ino b/examples/STM32WLx/STM32WLx_Receive_Blocking/STM32WLx_Receive_Blocking.ino index e2e90d62..5eaf4015 100644 --- a/examples/STM32WLx/STM32WLx_Receive_Blocking/STM32WLx_Receive_Blocking.ino +++ b/examples/STM32WLx/STM32WLx_Receive_Blocking/STM32WLx_Receive_Blocking.ino @@ -40,7 +40,7 @@ STM32WLx radio = new STM32WLx_Module(); // Some boards may not have either LP or HP. // For those, do not set the LP/HP entry in the table. static const uint32_t rfswitch_pins[] = - {PC3, PC4, PC5}; + {PC3, PC4, PC5, RADIOLIB_NC, RADIOLIB_NC}; static const Module::RfSwitchMode_t rfswitch_table[] = { {STM32WLx::MODE_IDLE, {LOW, LOW, LOW}}, {STM32WLx::MODE_RX, {HIGH, HIGH, LOW}}, diff --git a/examples/STM32WLx/STM32WLx_Receive_Interrupt/STM32WLx_Receive_Interrupt.ino b/examples/STM32WLx/STM32WLx_Receive_Interrupt/STM32WLx_Receive_Interrupt.ino index 6d91cea4..a4841f93 100644 --- a/examples/STM32WLx/STM32WLx_Receive_Interrupt/STM32WLx_Receive_Interrupt.ino +++ b/examples/STM32WLx/STM32WLx_Receive_Interrupt/STM32WLx_Receive_Interrupt.ino @@ -34,7 +34,7 @@ STM32WLx radio = new STM32WLx_Module(); // Some boards may not have either LP or HP. // For those, do not set the LP/HP entry in the table. static const uint32_t rfswitch_pins[] = - {PC3, PC4, PC5}; + {PC3, PC4, PC5, RADIOLIB_NC, RADIOLIB_NC}; static const Module::RfSwitchMode_t rfswitch_table[] = { {STM32WLx::MODE_IDLE, {LOW, LOW, LOW}}, {STM32WLx::MODE_RX, {HIGH, HIGH, LOW}}, diff --git a/examples/STM32WLx/STM32WLx_Transmit_Blocking/STM32WLx_Transmit_Blocking.ino b/examples/STM32WLx/STM32WLx_Transmit_Blocking/STM32WLx_Transmit_Blocking.ino index d35680a3..2bd2b02b 100644 --- a/examples/STM32WLx/STM32WLx_Transmit_Blocking/STM32WLx_Transmit_Blocking.ino +++ b/examples/STM32WLx/STM32WLx_Transmit_Blocking/STM32WLx_Transmit_Blocking.ino @@ -35,7 +35,7 @@ STM32WLx radio = new STM32WLx_Module(); // Some boards may not have either LP or HP. // For those, do not set the LP/HP entry in the table. static const uint32_t rfswitch_pins[] = - {PC3, PC4, PC5}; + {PC3, PC4, PC5, RADIOLIB_NC, RADIOLIB_NC}; static const Module::RfSwitchMode_t rfswitch_table[] = { {STM32WLx::MODE_IDLE, {LOW, LOW, LOW}}, {STM32WLx::MODE_RX, {HIGH, HIGH, LOW}}, diff --git a/examples/STM32WLx/STM32WLx_Transmit_Interrupt/STM32WLx_Transmit_Interrupt.ino b/examples/STM32WLx/STM32WLx_Transmit_Interrupt/STM32WLx_Transmit_Interrupt.ino index 60777c02..d22f77b5 100644 --- a/examples/STM32WLx/STM32WLx_Transmit_Interrupt/STM32WLx_Transmit_Interrupt.ino +++ b/examples/STM32WLx/STM32WLx_Transmit_Interrupt/STM32WLx_Transmit_Interrupt.ino @@ -26,7 +26,7 @@ STM32WLx radio = new STM32WLx_Module(); // Some boards may not have either LP or HP. // For those, do not set the LP/HP entry in the table. static const uint32_t rfswitch_pins[] = - {PC3, PC4, PC5}; + {PC3, PC4, PC5, RADIOLIB_NC, RADIOLIB_NC}; static const Module::RfSwitchMode_t rfswitch_table[] = { {STM32WLx::MODE_IDLE, {LOW, LOW, LOW}}, {STM32WLx::MODE_RX, {HIGH, HIGH, LOW}}, diff --git a/src/Module.cpp b/src/Module.cpp index 2dc37975..72d5ba59 100644 --- a/src/Module.cpp +++ b/src/Module.cpp @@ -565,7 +565,7 @@ size_t Module::serialPrintf(const char* format, ...) { void Module::setRfSwitchPins(uint32_t rxEn, uint32_t txEn) { // This can be on the stack, setRfSwitchTable copies the contents 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. @@ -578,7 +578,7 @@ void Module::setRfSwitchPins(uint32_t rxEn, uint32_t txEn) { 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)); this->rfSwitchTable = table; for(size_t i = 0; i < RFSWITCH_MAX_PINS; i++) diff --git a/src/Module.h b/src/Module.h index 72cb8e74..0cae4114 100644 --- a/src/Module.h +++ b/src/Module.h @@ -71,7 +71,7 @@ class Module { value is ever increased and such an array gets extra zero 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 @@ -546,7 +546,7 @@ class Module { uint32_t gpioPin = RADIOLIB_NC; // 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; #if RADIOLIB_INTERRUPT_TIMING