Open jmuchemb opened 7 months ago
First commit is important for performance because it avoids useless data copies when the caller provides a mutable buffer. Locally, I have an incomplete micropython-compat layer that I'd like to write as follows:
def readfrom_into(self, addr, buf, stop=True): self.transfer(addr, [self.Message(buf, read=True)])
But without this PR, I'd have to do:
def readfrom_into(self, addr, buf, stop=True): msg = self.Message(buf, read=True) self.transfer(addr, [msg]) buf[:] = msg.data
(off-topic: I don't know yet what to with the stop=True parameter)
stop=True
The next 2 commits are less important. They only relax some typing constraints, for free. I haven't checked my changes to i2c.pyi.
i2c.pyi
First commit is important for performance because it avoids useless data copies when the caller provides a mutable buffer. Locally, I have an incomplete micropython-compat layer that I'd like to write as follows:
But without this PR, I'd have to do:
(off-topic: I don't know yet what to with the
stop=True
parameter)The next 2 commits are less important. They only relax some typing constraints, for free. I haven't checked my changes to
i2c.pyi
.