Skip to content

Commit

Permalink
Allow LoRaWAN STM32WL driver debug led to be inverted (#14910)
Browse files Browse the repository at this point in the history
  • Loading branch information
hallard authored Jul 29, 2021
1 parent 3d36264 commit d13aaf4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
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": {
"help": "invert levels of the debug_rx and debug_tx pins. Default: 0 standard, 1 invert",
"value" : 0
}
},
"target_overrides": {
Expand Down

0 comments on commit d13aaf4

Please sign in to comment.