Still learning but boy is this fun. A big thanks to the people at Secret Labs !!
I have a TFT display like this one
http://www.elecfreak...#External_Links
I have connected it with SCK on D13,MOSI on D11, CS on D10, reset on A1, D/C on A2.
I have converted the source from the above link to C# and have no problem setting pixels on the display. Really slooow, but it works. Now, I would like to try using SPI to speed things up, but have run into some problems.
This is how I have found the SPI should be initialized :
Device1 = new SPI.Configuration( Pins.GPIO_PIN_D10, // CS-pin false, // CS-pin active state 0, // The setup time for the SS port 0, // The hold time for the SS port true, // The idle state of the clock false, // The sampling clock edge 1000, // The SPI clock rate in KHz SPI_Devices.SPI1 // The used SPI bus (refers to a MOSI MISO and SCLK pinset) ); SPIBus = new SPI(Device1);
I use the following for sending data/commands to the display. Note that if I set UseSPI=false everything works as expected
void LCD_Write_Bus(byte data) { if (UseSPI) { SPIBus.Write(new byte[] { data }); } else { P_CS.Write(false); for (byte c = 0; c < 8; c++) { P_MOSI.Write((data & 0x80) != 0); data = (byte)(data << 1); P_SCK.Write(false); P_SCK.Write(true); } P_CS.Write(true); } } void LCD_Write_COM(byte VL) { P_DC.Write(false); LCD_Write_Bus(VL); } void LCD_Write_DATA(byte VL) { P_DC.Write(true); LCD_Write_Bus(VL); }
Anyone experience who can point me in the right direction ?
Kjetil