From ae1bdde11c482609e89f32fd484357e26577e825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 17 Mar 2018 23:49:12 +0100 Subject: [PATCH] some convenience improvements --- gex/units/DOut.py | 8 ++++---- gex/units/SPI.py | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/gex/units/DOut.py b/gex/units/DOut.py index 2a56ad0..f1656b6 100644 --- a/gex/units/DOut.py +++ b/gex/units/DOut.py @@ -43,22 +43,22 @@ class DOut(gex.Unit): pb.u16(self.pins2int(pins)) self._send(CMD_TOGGLE, pb.close(), confirm=confirm) - def pulse_ms(self, pins, length, active=True, confirm=True): + def pulse_ms(self, ms, pins=0b01, active=True, confirm=True): """ Send a pulse with length 1-65535 ms on selected pins """ pb = gex.PayloadBuilder() pb.u16(self.pins2int(pins)) pb.bool(active) pb.bool(False) - pb.u16(length) + pb.u16(ms) self._send(CMD_PULSE, pb.close(), confirm=confirm) - def pulse_us(self, pins, length, active=True, confirm=True): + def pulse_us(self, us, pins=1, active=True, confirm=True): """ Send a pulse of 1-999 us on selected pins """ pb = gex.PayloadBuilder() pb.u16(self.pins2int(pins)) pb.bool(active) pb.bool(True) - pb.u16(length) + pb.u16(us) self._send(CMD_PULSE, pb.close(), confirm=confirm) diff --git a/gex/units/SPI.py b/gex/units/SPI.py index 97cb6f3..44bd6ef 100644 --- a/gex/units/SPI.py +++ b/gex/units/SPI.py @@ -14,6 +14,8 @@ class SPI(gex.Unit): If rskip is -1 (default), the tbytes length will be used. Set it to 0 to skip nothing. + + slave is 0-based index """ if rskip == -1: rskip = len(tbytes) @@ -24,7 +26,7 @@ class SPI(gex.Unit): pb.u16(rlen) pb.blob(tbytes) - # SPI does not respond if rlen is 0, but can be envorced using 'confirm' + # SPI does not respond if rlen is 0, but can be enforced using 'confirm' if rlen > 0: resp = self._query(0x00, pb.close()) return resp.data