I am looking at porting this library to micropython. While looking over the code I noticed an odd feature:
I was wondering why you had multiplied zero by a length in the function _spi_read "[register] + [0] * length, maybe it is me misunderstanding spidev but it seems unnecessary? Is is a left over from debugging?
def _spi_read(self, register, length=1):
if length == 1:
with self._hw_lock:
d = self.spi.xfer([register] + [0] * length)[1]
return d
else:
with self._hw_lock:
d = self.spi.xfer([register] + [0] * length)[1:]
return d
I am looking at porting this library to micropython. While looking over the code I noticed an odd feature:
I was wondering why you had multiplied zero by a length in the function _spi_read "[register] + [0] * length, maybe it is me misunderstanding spidev but it seems unnecessary? Is is a left over from debugging?