Hi,
I'm using the pyA13 0.2.2 SPI driver to send data to an LCD. Ideally I would like to send a list containing 320*240*2 (320*240 pixel 16 bits per color) bytes to be written in one continuous write command to be speed efficient. The drivers in spi.c and spi_lib.c had an 8bit tx_len which limited me to 256 bytes so I modified them to 32bit which worked but now I receive an error when I try to pass a list that is more than 4096 values long in my spi.write(data[:]) function. Below is the code I'm using to fill the screen with a solid color that is 16 bits:
def FillScreen(c):
LCD_SetPos(0, 0, 239, 319)
ch = c>>8 & 0x00FF
cl = c & 0x00FF
d =[]
for x in range (0,76800):
d += [ch, cl]
spi.write(d[:])
This is the error I get when I run the function:
Traceback (most recent call last):
File "lcd.py", line 205, in <module>
FillScreen(0x00FF)
File "lcd.py", line 200, in FillScreen
spi.write(d[:])
IOError: [Errno 90] Message too long
The piece of code that is giving me this error is contained in spi.c
/* Send data */
if(spi_write(fd, tx_buffer, tx_len) < 0){
return PyErr_SetFromErrno(PyExc_IOError);
}
Is there any way that I can pass a longer message to the spi.write function? I have tried looping smaller messages to fill the screen but that takes too long. Any help would be appreciated.
Thanks,
Michael