Skip to content

Commit d13aaf4

Browse files
authored
Allow LoRaWAN STM32WL driver debug led to be inverted (#14910)
1 parent 3d36264 commit d13aaf4

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

connectivity/drivers/lora/TARGET_STM32WL/STM32WL_LoRaRadio.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ const float lora_symbol_time[3][6] = {{ 32.768, 16.384, 8.192, 4.096, 2.048, 1.0
115115

116116

117117
#ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_RX
118-
static DigitalOut _rf_dbg_rx(MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_RX, 0);
118+
static DigitalOut _rf_dbg_rx(MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_RX, MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT);
119119
#endif
120120

121121
#ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_TX
122-
static DigitalOut _rf_dbg_tx(MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_TX, 0);
122+
static DigitalOut _rf_dbg_tx(MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_TX, MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT);
123123
#endif
124124

125125

@@ -302,7 +302,7 @@ void STM32WL_LoRaRadio::HAL_SUBGHZ_TxCpltCallback(void)
302302

303303
#ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_TX
304304
/* Reset TX DBG pin */
305-
_rf_dbg_tx = 0;
305+
_rf_dbg_tx = MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT;
306306
#endif
307307
}
308308
}
@@ -330,7 +330,7 @@ void STM32WL_LoRaRadio::HAL_SUBGHZ_RxCpltCallback(void)
330330

331331
#ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_RX
332332
/* Reset RX DBG pin */
333-
_rf_dbg_rx = 0;
333+
_rf_dbg_rx = MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT;
334334
#endif
335335
}
336336
}
@@ -360,15 +360,15 @@ void STM32WL_LoRaRadio::HAL_SUBGHZ_RxTxTimeoutCallback(void)
360360

361361
#if MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_TX
362362
/* Reset TX DBG pin */
363-
_rf_dbg_tx = 0;
363+
_rf_dbg_tx = MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT;
364364
#endif
365365

366366
} else if ((_radio_events && _radio_events->rx_timeout) && (_operating_mode == MODE_RX)) {
367367
_radio_events->rx_timeout();
368368

369369
#ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_RX
370370
/* Reset RX DBG pin */
371-
_rf_dbg_rx = 0;
371+
_rf_dbg_rx = MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT;
372372
#endif
373373
}
374374
}
@@ -1079,7 +1079,7 @@ void STM32WL_LoRaRadio::send(uint8_t *buffer, uint8_t size)
10791079

10801080
#ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_TX
10811081
/* Set TX DBG pin */
1082-
_rf_dbg_tx = 1;
1082+
_rf_dbg_tx = !MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT;
10831083
#endif
10841084

10851085
/* Set RF switch */
@@ -1137,7 +1137,7 @@ void STM32WL_LoRaRadio::receive(void)
11371137

11381138
#ifdef MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_RX
11391139
/* Set RX DBG pin */
1140-
_rf_dbg_rx = 1;
1140+
_rf_dbg_rx = !MBED_CONF_STM32WL_LORA_DRIVER_DEBUG_INVERT;
11411141
#endif
11421142

11431143
/* RF switch configuration */

connectivity/drivers/lora/TARGET_STM32WL/mbed_lib.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
},
4848
"debug_tx": {
4949
"help": "GPIO pin for TX debug"
50+
},
51+
"debug_invert": {
52+
"help": "invert levels of the debug_rx and debug_tx pins. Default: 0 standard, 1 invert",
53+
"value" : 0
5054
}
5155
},
5256
"target_overrides": {

0 commit comments

Comments
 (0)