Skip to content

Allow LoRaWAN STM32WL driver debug led to be inverted #14910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -360,15 +360,15 @@ 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)) {
_radio_events->rx_timeout();

#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
}
}
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down
4 changes: 4 additions & 0 deletions connectivity/drivers/lora/TARGET_STM32WL/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
},
"debug_tx": {
"help": "GPIO pin for TX debug"
},
"debug_invert": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug_led_invert might be better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely the deal is that I wanted to be consistent with already related existing options. It took me some time to understand that ˋdebug_tx` was for led and not a serial. So if I change it it would makes sense to change 2 other (and introduce breaking change). Whatever solution is fine for me

Copy link
Collaborator

@jeromecoutant jeromecoutant Jul 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug_led_invert might be better

Hi

Not sure, as primary goal of the debug GPIO is to easily use logic analyser for example.
Usage of LEDs is only an "extension"

Copy link
Contributor Author

@hallard hallard Jul 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug_led_invert might be better

Hi

Not sure, as primary goal of the debug GPIO is to easily use logic analyser for example.
Usage of LEDs is only an "extension"

makes sense

"help": "invert levels of the debug_rx and debug_tx pins. Default: 0 standard, 1 invert",
"value" : 0
}
},
"target_overrides": {
Expand Down