nopnop2002 / Raspberry-ili9325

Parallel TFT Shield Library for wiringPi
64 stars 14 forks source link

Please add support for ili9341 16bit data bus #20

Closed myg3nx closed 6 years ago

myg3nx commented 6 years ago

Hi.. thanks for awsome library... i have test your library and its work... but i have an issue that the color doesnt show correctly, maybe because i have 16bit data bus (16 pin paralel data) but the library implement just 8 bit data bus (8 pin parallel data). If you have any spare time please add support for 16bit data so the color can show correctly... thanks

nopnop2002 commented 6 years ago

Please tell me the information by which it's a store where you got your TFT.

myg3nx commented 6 years ago

Thankyou for ur replay... im using this lcd

https://m.aliexpress.com/item/32808968215.html

nopnop2002 commented 6 years ago

Do I have to process wiring in the back?

myg3nx commented 6 years ago

Im sorry if i missunderstood your question.

I have change your pin.conf file

I only use pin d0-d7,wr,cs,rst,rd,rs I leave pin d8-d15 unconnected. Im using opi lite. After i turnon the lcd i get funny color... :(

nopnop2002 commented 6 years ago

OK Thank you. I ordered the same one.

nopnop2002 commented 6 years ago

I have one more question. Is injustice only the color? Is the location right?

myg3nx commented 6 years ago

Only color that have an issue... the demo.c work perfectly without problem

myg3nx commented 6 years ago

Here is little screenshot of mine

http://www.imagebam.com/image/073145892206914

nopnop2002 commented 6 years ago

Thank you for your screenshot.

myg3nx commented 6 years ago

hi, i have resolve my issue by changing some of your code. here is how to makeit work ////// file pin.conf /////

Number is WiringPi Number(NOT GPIO Number)

RST=5 CS=15 RS=16 WR=1 RD=4 D0=6 D1=10 D2=11 D3=31 D4=26 D5=27 D6=28 D7=29 D8=8 D9=9 D10=7 D11=0 D12=2 D13=3 D14=12 D15=13 //// eof /////

/////////// file ili93xx.h ////// typedef struct { int rst; int cs; int rs; int wr; int rd; int d0; int d1; int d2; int d3; int d4; int d5; int d6; int d7; int d8; int d9; int d10; int d11; int d12; int d13; int d14; int d15; } TFTPin; /// add public function void mylcdWriteByte(uint16_t data); void mylcdWriteDataWord(uint16_t data); //////// eof //////

/////////// file ili93xx.c ////// //// add public function //// void mylcdWriteByte(uint16_t data) { digitalWrite(pins.d0, data & 1); digitalWrite(pins.d1, (data & 2) >> 1); digitalWrite(pins.d2, (data & 4) >> 2); digitalWrite(pins.d3, (data & 8) >> 3); digitalWrite(pins.d4, (data & 16) >> 4); digitalWrite(pins.d5, (data & 32) >> 5); digitalWrite(pins.d6, (data & 64) >> 6); digitalWrite(pins.d7, (data & 128) >> 7); digitalWrite(pins.d8, (data & 256) >> 8); digitalWrite(pins.d9, (data & 512) >> 9); digitalWrite(pins.d10, (data & 1024) >> 10); digitalWrite(pins.d11, (data & 2048) >> 11); digitalWrite(pins.d12, (data & 4096) >> 12); digitalWrite(pins.d13, (data & 8192) >> 13); digitalWrite(pins.d14, (data & 16384) >> 14); digitalWrite(pins.d15, (data & 32768) >> 15); } void mylcdWriteDataWord(uint16_t data) { digitalWrite(pins.cs, LOW); digitalWrite(pins.rs, HIGH); digitalWrite(pins.rd, HIGH); digitalWrite(pins.wr, HIGH); mylcdWriteByte(data); digitalWrite(pins.wr, LOW); delayMicroseconds(10); digitalWrite(pins.wr, HIGH); digitalWrite(pins.cs, HIGH); } //// change code at line 472 with mylcdWriteDataWord(color);

//// change code at line 518 with mylcdWriteDataWord(color);

//// add this code at line 1032 with else if (strncmp(buff,"D8=",3) == 0) { sscanf(buff, "D8=%d", &(pin->d8)); } else if (strncmp(buff,"D9=",3) == 0) { sscanf(buff, "D9=%d", &(pin->d9)); } else if (strncmp(buff,"D10=",4) == 0) { sscanf(buff, "D10=%d", &(pin->d10)); } else if (strncmp(buff,"D11=",4) == 0) { sscanf(buff, "D11=%d", &(pin->d11)); } else if (strncmp(buff,"D12=",4) == 0) { sscanf(buff, "D12=%d", &(pin->d12)); } else if (strncmp(buff,"D13=",4) == 0) { sscanf(buff, "D13=%d", &(pin->d13)); } else if (strncmp(buff,"D14=",4) == 0) { sscanf(buff, "D14=%d", &(pin->d14)); } else if (strncmp(buff,"D15=",4) == 0) { sscanf(buff, "D15=%d", &(pin->d15)); }

//// eof ///// done this is a dirty how to make it work, i will wait from author CLEAN version of writing code... btw thanks for ur library..... :)

nopnop2002 commented 6 years ago

You're wonderful!

When I receive my TFT I ordered, I'll try your code. I consider a change in 8Bit/16Bit by a compilation option.

for ILI9481(8bit) cc -o demo demo.c fontx.c ili93xx.c -lwiringPi -lm -lpthread -DILI9481

for ILI9481(16bit) cc -o demo demo.c fontx.c ili93xx.c -lwiringPi -lm -lpthread -DILI9481 -D16BIT

I'm thankful for your cooperation.

nopnop2002 commented 6 years ago

I marged your cord. Thank you.

myg3nx commented 6 years ago

Thank you... :)

nopnop2002 commented 6 years ago

This module has SPI-Touch Sensor.
So you can read touch position.
And you can operate Pi using touch sensor.