diff options
author | Damien George <damien.p.george@gmail.com> | 2020-02-27 15:36:53 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-02-28 10:33:03 +1100 |
commit | 69661f3343bedf86e514337cff63d96cc42f8859 (patch) | |
tree | af5dfb380ffdb75dda84828f63cf9d840d992f0f /examples/bluetooth/ble_uart_repl.py | |
parent | 3f39d18c2b884d32f0443e2e8114ff9d7a14d718 (diff) | |
download | micropython-69661f3343bedf86e514337cff63d96cc42f8859.tar.gz micropython-69661f3343bedf86e514337cff63d96cc42f8859.zip |
all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
Diffstat (limited to 'examples/bluetooth/ble_uart_repl.py')
-rw-r--r-- | examples/bluetooth/ble_uart_repl.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/bluetooth/ble_uart_repl.py b/examples/bluetooth/ble_uart_repl.py index 430a571a69..9e8a38ff4b 100644 --- a/examples/bluetooth/ble_uart_repl.py +++ b/examples/bluetooth/ble_uart_repl.py @@ -15,7 +15,7 @@ _MP_STREAM_POLL = const(3) _MP_STREAM_POLL_RD = const(0x0001) # TODO: Remove this when STM32 gets machine.Timer. -if hasattr(machine, 'Timer'): +if hasattr(machine, "Timer"): _timer = machine.Timer(-1) else: _timer = None @@ -24,11 +24,13 @@ else: def schedule_in(handler, delay_ms): def _wrap(_arg): handler() + if _timer: _timer.init(mode=machine.Timer.ONE_SHOT, period=delay_ms, callback=_wrap) else: micropython.schedule(_wrap, None) + # Simple buffering stream to support the dupterm requirements. class BLEUARTStream(io.IOBase): def __init__(self, uart): @@ -38,7 +40,7 @@ class BLEUARTStream(io.IOBase): def _on_rx(self): # Needed for ESP32. - if hasattr(os, 'dupterm_notify'): + if hasattr(os, "dupterm_notify"): os.dupterm_notify(None) def read(self, sz=None): @@ -74,7 +76,7 @@ class BLEUARTStream(io.IOBase): def start(): ble = bluetooth.BLE() - uart = BLEUART(ble, name='mpy-repl') + uart = BLEUART(ble, name="mpy-repl") stream = BLEUARTStream(uart) os.dupterm(stream) |