summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2023-09-30 08:27:22 +0200
committerDamien George <damien@micropython.org>2023-10-02 11:31:24 +1100
commit6482eb142c6d9b88b3897356d00399226056c603 (patch)
treeea5ab5bf3c55cbca9b11b7f917d8cf3d378c972b
parent51ca23e4634788ddf8971de4d4b462bbeb4c7684 (diff)
mimxrt/mpbthciport: Allow disabling UART flow control for BLE.
Not all boards or BLE extensions have the flow control signals for BLE available at suitable pins. Actually none of the Adafruit extensions match for flow control. For consistency with the previous behaviour it is enabled by default. Signed-off-by: robert-hh <robert@hammelrath.com>
-rw-r--r--ports/mimxrt/mpbthciport.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ports/mimxrt/mpbthciport.c b/ports/mimxrt/mpbthciport.c
index 2540abca4..4325655e5 100644
--- a/ports/mimxrt/mpbthciport.c
+++ b/ports/mimxrt/mpbthciport.c
@@ -36,6 +36,10 @@
#if MICROPY_PY_BLUETOOTH
+#ifndef MICROPY_HW_BLE_UART_FLOW_CONTROL
+#define MICROPY_HW_BLE_UART_FLOW_CONTROL (3)
+#endif
+
#define DEBUG_printf(...) // mp_printf(&mp_plat_print, "mpbthciport.c: " __VA_ARGS__)
#define ERROR_printf(...) mp_printf(&mp_plat_print, "mpbthciport.c: " __VA_ARGS__)
@@ -85,7 +89,7 @@ int mp_bluetooth_hci_uart_init(uint32_t port, uint32_t baudrate) {
mp_obj_t args[] = {
MP_OBJ_NEW_SMALL_INT(port),
MP_OBJ_NEW_QSTR(MP_QSTR_baudrate), MP_OBJ_NEW_SMALL_INT(baudrate),
- MP_OBJ_NEW_QSTR(MP_QSTR_flow), MP_OBJ_NEW_SMALL_INT(3),
+ MP_OBJ_NEW_QSTR(MP_QSTR_flow), MP_OBJ_NEW_SMALL_INT(MICROPY_HW_BLE_UART_FLOW_CONTROL),
MP_OBJ_NEW_QSTR(MP_QSTR_timeout), MP_OBJ_NEW_SMALL_INT(200),
MP_OBJ_NEW_QSTR(MP_QSTR_timeout_char), MP_OBJ_NEW_SMALL_INT(200),
MP_OBJ_NEW_QSTR(MP_QSTR_txbuf), MP_OBJ_NEW_SMALL_INT(768),