Clean up comments

This commit is contained in:
James Bowman 2020-02-18 16:16:13 -08:00
parent 0de77f100c
commit 3aaad8a7de
1 changed files with 15 additions and 3 deletions

View File

@ -68,7 +68,15 @@ class I2CDriver:
""" """
A connected I2CDriver. A connected I2CDriver.
:ivar product: product code e.g. 'i2cdriver1' :param port: The USB port to connect to
:type port: str
:param reset: Issue an I2C bus reset on connection
:type reset: bool
After connection, the following object variables reflect the current values of the I2CDriver.
They are updated by calling :py:meth:`getstatus`.
:ivar product: product code e.g. 'i2cdriver1' or 'i2cdriverm'
:ivar serial: serial string of I2CDriver :ivar serial: serial string of I2CDriver
:ivar uptime: time since I2CDriver boot, in seconds :ivar uptime: time since I2CDriver boot, in seconds
:ivar voltage: USB voltage, in V :ivar voltage: USB voltage, in V
@ -269,7 +277,7 @@ class I2CDriver:
:param reg: register address 0-255 :param reg: register address 0-255
:param fmt: :py:func:`struct.unpack` format string for the register contents, or an integer byte count :param fmt: :py:func:`struct.unpack` format string for the register contents, or an integer byte count
If device 0x75 has a 16-bit register 102, it can be read with: If device 0x75 has a 16-bit unsigned big-endian register 102, it can be read with:
>>> i2c.regrd(0x75, 102, ">H") >>> i2c.regrd(0x75, 102, ">H")
4999 4999
@ -335,7 +343,6 @@ class I2CDriver:
self.__echo(0x40) self.__echo(0x40)
def introspect(self): def introspect(self):
""" Update all status variables """
self.ser.write(b'J') self.ser.write(b'J')
r = self.ser.read(80) r = self.ser.read(80)
assert len(r) == 80, r assert len(r) == 80, r
@ -360,6 +367,11 @@ class I2CDriver:
self.sda) self.sda)
def capture_start(self, idle=False, start = START, abyte = BYTE, stop = STOP): def capture_start(self, idle=False, start = START, abyte = BYTE, stop = STOP):
"""Enter I2C capture mode, capturing I2C transactions.
:param idle: If ``True`` the generator returns ``None`` when the bus is idle. If ``False`` the generator does nothing during bus idle.
:return: a generator which returns an object for each I2C primitive captured.
"""
self.__ser_w([ord('c')]) self.__ser_w([ord('c')])
def nstream(): def nstream():
while True: while True: