Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type interface to writebytes not clear #118

Open
PeterWurmsdobler opened this issue Feb 23, 2021 · 1 comment
Open

Type interface to writebytes not clear #118

PeterWurmsdobler opened this issue Feb 23, 2021 · 1 comment

Comments

@PeterWurmsdobler
Copy link

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 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.

@doceme
Copy link
Owner

doceme commented Nov 3, 2022

Can you provide some sample code that demonstrates this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants