How much data does SPI.readinto reads?
Posted: Mon Jan 23, 2017 2:52 pm
Official documentation says:
SPI.readinto(buf, write=0x00)
Read into the buffer specified by buf while continuously writing the single byte given by write. Returns None.
Note: on WiPy this function returns the number of bytes read.
I wonder how can I specify length of data to be read by SPI.readinto() method? If it is the same as buffer length then what is the purpose for it? I have a board connected to esp which takes commands of different lengths and replies with answers of different lengths. To optimize reading from it I want to use pre-allocated buffer. However this way it will have constant length and I will need to shrink or expand it every time length of replies changes. That is not the optimization.
SPI.readinto(buf, write=0x00)
Read into the buffer specified by buf while continuously writing the single byte given by write. Returns None.
Note: on WiPy this function returns the number of bytes read.
I wonder how can I specify length of data to be read by SPI.readinto() method? If it is the same as buffer length then what is the purpose for it? I have a board connected to esp which takes commands of different lengths and replies with answers of different lengths. To optimize reading from it I want to use pre-allocated buffer. However this way it will have constant length and I will need to shrink or expand it every time length of replies changes. That is not the optimization.