ucglib icon indicating copy to clipboard operation
ucglib copied to clipboard

ILI9342 driver

Open nbonniere opened this issue 3 years ago • 7 comments

I have been trying to modify the ILI9341 driver to make an ILI9342 driver but I am not successful so far. There is a blank area on the right when in landscape mode and an blank area at the top when rotated 90 deg. Can't seem to find a register that would explain this offset. Would you have time to generate a proper ILI9342 driver ?

nbonniere avatar May 19 '21 15:05 nbonniere

Hi,

Where did you find this screen? in the m5stack? I have made a working driver for it. I'll send a pull request.

edit: Sorry I did not find this issue sooner!

slorquet avatar Jan 26 '23 11:01 slorquet

Well in fact I did it before and it is still not pushed upstream.

Do you have this problem? https://github.com/olikraus/ucglib/issues/100 Is this what you need? https://github.com/olikraus/Ucglib_Arduino/pull/23

slorquet avatar Jan 26 '23 11:01 slorquet

Yes, it was for the M5stack, and yes it was a blank area as problem #100. I managed to eventually modify the ILI9341 driver and create an ILI9342 driver that works.

nbonniere avatar Jan 26 '23 13:01 nbonniere

I updated my fork with my code. Match is very close, except for UCG_VARX and UCG_VARY. Not sure which is right (?) https://github.com/nbonniere/ucglib

nbonniere avatar Jan 27 '23 15:01 nbonniere

I like the ILI9342 name instead of my use of m5stack. I had doubt the ILI9342 was the chip name for the portrait screen but I see new docs now and it seem to be the right choice.

I had a look at the differences: For UCG_VARX we do EXACTLY the same:

 me:  UCG_C10(0x02a),	UCG_VARX(8,0x01, 0), UCG_VARX(0,0x0ff, 0), UCG_A2(0x001, 0x03f),		/* set x position */
you:  UCG_C10(0x02a),	UCG_VARX(8,0x01, 0), UCG_VARX(0,0x0ff, 0), UCG_A2(0x001, 0x03f),

But for UCG_VARY:

 me:  UCG_C10(0x02b),	UCG_VARY(8,0x01, 0), UCG_VARY(0,0x0ff, 0), UCG_A2(0x000, 0x0ef),		/* set y position */
you:  UCG_C10(0x02b),	UCG_VARY(0,0x00, 0), UCG_VARY(0,0x0ff, 0), UCG_A2(0x000, 0x0ef),	

I have no idea what the differences are.

These are the definitions from ucg.h

/* access procedures to ucg->arg.pixel.pos.x und ucg->arg.pixel.pos.y */
#define UCG_VARX(s,a,o)				0x0a0 | ((s)&15), (a), (o)
#define UCG_VARY(s,a,o)				0x0b0 | ((s)&15), (a), (o)

I have used the same values in varx and vary by symmetry, what was your reason to use s=0 and a=0 instead?

slorquet avatar Jan 27 '23 15:01 slorquet

I reversed what was used in the 9341 since X is swapped with Y in the 9342. Pure guess at this time, and display works OK, so I didn't check further.

  • 9341 UCG_C10(0x02a), UCG_VARX(0,0x00, 0), UCG_VARX(0,0x0ff, 0), UCG_A2(0x000, 0x0ef), /* set x position / UCG_C10(0x02b), UCG_VARY(8,0x01, 0), UCG_VARY(0,0x0ff, 0), UCG_A2(0x001, 0x03f), / set y position */
  • 9342 UCG_C10(0x02a), UCG_VARX(8,0x01, 0), UCG_VARX(0,0x0ff, 0), UCG_A2(0x001, 0x03f), /* set x position / UCG_C10(0x02b), UCG_VARY(0,0x00, 0), UCG_VARY(0,0x0ff, 0), UCG_A2(0x000, 0x0ef), / set y position */

nbonniere avatar Jan 27 '23 15:01 nbonniere

OK, makes sense, and thanks. I hope your driver gets integrated. It is frustrating that this project is not maintained anymore.

slorquet avatar Jan 27 '23 16:01 slorquet