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

returning from wiringPiSPIDataRW #85

Closed
eczajk1 opened this issue Oct 26, 2017 · 1 comment
Closed

returning from wiringPiSPIDataRW #85

eczajk1 opened this issue Oct 26, 2017 · 1 comment

Comments

@eczajk1
Copy link

eczajk1 commented Oct 26, 2017

I am using the following function to try to read from the SPI bus on RaspberryPi3:

wpi.wiringPiSPIDataRW(1, new Buffer([0xFF]));

... this evaluates to an integer that seems to be equal to the length of my buffer (1 in this case). I guess I don't understand if there is something different I need to be doing with the 2nd parameter here.

For context, I am trying to emulate what this Python library is doing:

https://github.com/ul-gh/PiPyADC/blob/3f9ccd83a7680652255d3909d082d9b14176e289/pipyadc.py#L358-L370

@eczajk1
Copy link
Author

eczajk1 commented Oct 26, 2017

Nevermind, I get it now:

var myBuf = new Buffer([0xFF]);
wpi.wiringPiSPIDataRW(1, myBuf);
return myBuf[0];

@eczajk1 eczajk1 closed this as completed Oct 26, 2017
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

1 participant