Page 1 of 1


Posted: Wed Nov 20, 2013 2:45 am
by mike808
I've been trying to use spidev and SPI communication with my PI. I looked at the Arduino code and it looks like this:

Code: Select all

void Adafruit_ILI9340::writecommand(uint8_t c) {
  CLEAR_BIT(dcport, dcpinmask);
  //digitalWrite(_dc, LOW);
  CLEAR_BIT(clkport, clkpinmask);
  //digitalWrite(_sclk, LOW);
  CLEAR_BIT(csport, cspinmask);
  //digitalWrite(_cs, LOW);


  SET_BIT(csport, cspinmask);
  //digitalWrite(_cs, HIGH);
My question is does spidev handle the "CLEAR_BIT" and "SET_BIT" or do I need to manually do that myself? I've tried both ways and no luck. Arduino code works fine, but I wanted to write a userspace program that could communicate with my device (TFT display with ILI9340C).

I don't get errors sending, but device doesn't do anything I expected (tried a simple command to turn off the display).

Does anyone have a SPI userspace program they can share as an example?

Re: SPI on PI

Posted: Wed Nov 20, 2013 1:07 pm
by DougieLawson
There's a good python sample in the Quick2Wire stuff at