usart fixes

doublebuf
Ondřej Hruška 7 years ago
parent 70d322443e
commit 0789992063
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 4
      gex/units/USART.py
  2. 1
      main.py

@ -19,12 +19,12 @@ class USART(gex.Unit):
def write(self, payload, sync=False, confirm=True):
"""
Write bytes. If 'sync' is True, wait for completion.
Write bytes. If 'sync' is True, wait for completion. sync implies confirm
"""
pb = gex.PayloadBuilder()
pb.blob(payload) # payload to write
self._send(0x01 if sync else 0x00, pb.close(), confirm=confirm)
self._send(0x01 if sync else 0x00, pb.close(), confirm=confirm or sync)
def _on_event(self, event:int, payload):
if event == 0:

@ -90,6 +90,7 @@ if False:
if True:
usart = gex.USART(client, 'serial')
usart.listen(lambda x: print("RX >%s<" % x))
for i in range(0,100):
# Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque ac bibendum lectus, ut pellentesque sem. Suspendisse ultrices felis eu laoreet luctus. Nam sollicitudin ultrices leo, ac condimentum enim vulputate quis. Suspendisse cursus tortor nibh, ac consectetur eros dapibus quis. Aliquam erat volutpat. Duis sagittis eget nunc nec condimentum. Aliquam erat volutpat. Phasellus molestie sem vitae quam semper convallis.

Loading…
Cancel
Save