all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user