diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2019-11-13 17:02:50 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-11-25 17:32:10 +1100 |
commit | fbb7646e3bd6fd17b2c39ac40d537cc0b07af188 (patch) | |
tree | 2414ff58d90da7dea37eaf5954d46a8f1d80fdd0 | |
parent | 438c0dc2a4ab27883bab80a40372a44d7f5fe963 (diff) |
stm32/nimble_hci_uart.c: Prevent scheduler running during CYW-BT wakeup.
Using mp_hal_delay_ms allows the scheduler to run, which might result in
another transmit operation happening, which would bypass the sleep (and
fail). Use mp_hal_delay_us instead.
-rw-r--r-- | ports/stm32/nimble_hci_uart.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ports/stm32/nimble_hci_uart.c b/ports/stm32/nimble_hci_uart.c index defda1581..69e89e6ab 100644 --- a/ports/stm32/nimble_hci_uart.c +++ b/ports/stm32/nimble_hci_uart.c @@ -162,7 +162,9 @@ void nimble_hci_uart_tx_strn(const char *str, uint len) { if (mp_hal_pin_read(pyb_pin_BT_DEV_WAKE) == 1) { //printf("BT WAKE for TX\n"); mp_hal_pin_low(pyb_pin_BT_DEV_WAKE); // wake up - mp_hal_delay_ms(5); // can't go lower than this + // Use delay_us rather than delay_ms to prevent running the scheduler (which + // might result in more BLE operations). + mp_hal_delay_us(5000); // can't go lower than this } #endif |