diff --git a/connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.cpp b/connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.cpp index 6a7df14b8df..a6ad4c77e09 100644 --- a/connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.cpp +++ b/connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.cpp @@ -115,11 +115,11 @@ const float lora_symbol_time[3][6] = {{ 32.768, 16.384, 8.192, 4.096, 2.048, 1.0 #ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_RX -static DigitalOut _rf_dbg_rx(MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_RX, 0); +static DigitalOut _rf_dbg_rx(MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_RX, MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT); #endif #ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_TX -static DigitalOut _rf_dbg_tx(MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_TX, 0); +static DigitalOut _rf_dbg_tx(MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_TX, MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT); #endif @@ -302,7 +302,7 @@ void STM32WL_LoRaRadio::HAL_SUBGHZ_TxCpltCallback(void) #ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_TX /* Reset TX DBG pin */ - _rf_dbg_tx = 0; + _rf_dbg_tx = MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT; #endif } } @@ -330,7 +330,7 @@ void STM32WL_LoRaRadio::HAL_SUBGHZ_RxCpltCallback(void) #ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_RX /* Reset RX DBG pin */ - _rf_dbg_rx = 0; + _rf_dbg_rx = MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT; #endif } } @@ -360,7 +360,7 @@ void STM32WL_LoRaRadio::HAL_SUBGHZ_RxTxTimeoutCallback(void) #if MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_TX /* Reset TX DBG pin */ - _rf_dbg_tx = 0; + _rf_dbg_tx = MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT; #endif } else if ((_radio_events && _radio_events->rx_timeout) && (_operating_mode == MODE_RX)) { @@ -368,7 +368,7 @@ void STM32WL_LoRaRadio::HAL_SUBGHZ_RxTxTimeoutCallback(void) #ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_RX /* Reset RX DBG pin */ - _rf_dbg_rx = 0; + _rf_dbg_rx = MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT; #endif } } @@ -1079,7 +1079,7 @@ void STM32WL_LoRaRadio::send(uint8_t *buffer, uint8_t size) #ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_TX /* Set TX DBG pin */ - _rf_dbg_tx = 1; + _rf_dbg_tx = !MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT; #endif /* Set RF switch */ @@ -1137,7 +1137,7 @@ void STM32WL_LoRaRadio::receive(void) #ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_RX /* Set RX DBG pin */ - _rf_dbg_rx = 1; + _rf_dbg_rx = !MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT; #endif /* RF switch configuration */ diff --git a/connectivity/drivers/lora/TARGET_STM32WL/mbed_lib.json b/connectivity/drivers/lora/TARGET_STM32WL/mbed_lib.json index 4a5ab666fd6..31545441760 100644 --- a/connectivity/drivers/lora/TARGET_STM32WL/mbed_lib.json +++ b/connectivity/drivers/lora/TARGET_STM32WL/mbed_lib.json @@ -47,6 +47,10 @@ }, "debug_tx": { "help": "GPIO pin for TX debug" + }, + "debug_invert": { + "help": "invert levels of the debug_rx and debug_tx pins. Default: 0 standard, 1 invert", + "value" : 0 } }, "target_overrides": {