You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first, thanks for providing this library that allows accessing devices over SPI in python; that is very convenient.
The name of the method writebytes alludes to the data type needing to be some kind of unsigned char or some uint8 from the ctypes. Having written code around this assumption I found that I always go a TypeError: Non-In/Long value in argument. Going through the c-code I realised that there a converion to __u8 is being performed. So my assumption was wrong.
Bottom line, it appears that writebytes accepts a list of int rather than bytes which are then cast to an unsigned 8 bit quantity. I wonder whether that could be made clearer in the documentation.
Cheers, peter.
The text was updated successfully, but these errors were encountered:
Hello,
first, thanks for providing this library that allows accessing devices over SPI in python; that is very convenient.
The name of the method
writebytes
alludes to the data type needing to be some kind ofunsigned char
or someuint8
from thectypes
. Having written code around this assumption I found that I always go aTypeError: Non-In/Long value in argument
. Going through the c-code I realised that there a converion to__u8
is being performed. So my assumption was wrong.Bottom line, it appears that
writebytes
accepts a list ofint
rather than bytes which are then cast to an unsigned 8 bit quantity. I wonder whether that could be made clearer in the documentation.Cheers, peter.
The text was updated successfully, but these errors were encountered: