1. I am using RPi2 with raspbian loaded. I am using SPI library from here:
http://www.raspberrypi-spy.co.uk/2013/10/analogue-sensors-on-the-raspberry-pi-using-an-mcp3008/
Also .c file I have attached.
2. Problem is I don't understand how to call functions here.
e.g This is how tx/rx function is defined:
static PyObject *SpiDev_xfer2(SpiDevObject *self, PyObject *args)
It has two struct arguments. But when function is called, it is called as:
adc = spi.xfer2([1,2,3])
where argument contains list of values you want to tx & it reurns valye rx.
http://www.raspberrypi-spy.co.uk/2013/10/analogue-sensors-on-the-raspberry-pi-using-an-mcp3008/
Also .c file I have attached.
2. Problem is I don't understand how to call functions here.
e.g This is how tx/rx function is defined:
static PyObject *SpiDev_xfer2(SpiDevObject *self, PyObject *args)
It has two struct arguments. But when function is called, it is called as:
adc = spi.xfer2([1,2,3])
where argument contains list of values you want to tx & it reurns valye rx.
Attachments
-
20.3 KB Views: 2