Skip to content

Commit

Permalink
actually fixed message length parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
lthiery committed Jan 17, 2013
1 parent 340a0de commit 74b7d9e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
Binary file modified build/lib.linux-armv6l-2.7/spi.so
Binary file not shown.
Binary file modified build/temp.linux-armv6l-2.7/spi.o
Binary file not shown.
10 changes: 6 additions & 4 deletions spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ static PyObject* initialize(PyObject* self, PyObject* args)
if(!PyArg_ParseTuple(args, "siii", &modeString, &bits, &speed, &delay))
*/
//this works at least but I don't know what the different modes are by integer

if( !(PyArg_ParseTuple(args,"") || PyArg_ParseTuple(args,"iiii", &mode, &bytesPerMessage, &speed, &delay)) )
return NULL;
PyErr_Clear();
/*
uint8_t i;
for(i=0;i<sizeof(modeString) / sizeof(char);i++){
Expand Down Expand Up @@ -183,18 +185,18 @@ static PyObject* transfer(PyObject* self, PyObject* args)
if (ret < 1)
pabort("can't send spi message");

/*
/*
printf("Received: \n");
for (ret = 0; ret < ARRAY_SIZE; ret++) {
if (!(ret % 4) && ret!=0)
puts("");
printf("%.2X ", rx[ret]);
}
puts("");
*/
*/

pyObj = PyTuple_New(bits);
for(i=0;i<bits;i++)
pyObj = PyTuple_New(bytesPerMessage);
for(i=0;i<bytesPerMessage;i++)
PyTuple_SetItem(pyObj, i, Py_BuildValue("i",rx[i]));

return pyObj;
Expand Down
Binary file modified spi.so
Binary file not shown.

0 comments on commit 74b7d9e

Please sign in to comment.