Library ILI9481 320*480 3.5

Working libraries, libraries being ported and related hardware
Post Reply
mrmolano
Posts: 1
Joined: Sun Jan 29, 2017 10:12 pm

Library ILI9481 320*480 3.5

Post by mrmolano » Sun Jan 29, 2017 10:33 pm

Hi

I modify the library of iwalpola the Adafruit ILI9341 8bit STM to work with the ILI9481, I leave the link from mega
https://mega.nz/#!59NmzIRA!EB3XwPoYjhPA ... XVYZB7A6iQ

bye

User avatar
RogerClark
Posts: 5897
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Library ILI9481 320*480 3.5

Post by RogerClark » Mon Jan 30, 2017 6:42 am

Thanks for sharing.

Ideally this should be put on github etc where people can easily view and download the source, rather than a zip

User avatar
Dimdim
Posts: 8
Joined: Mon May 09, 2016 10:34 am
Location: Athens, Greece
Contact:

Re: Library ILI9481 320*480 3.5

Post by Dimdim » Sat Feb 25, 2017 11:20 pm

Lovely port! Very useful.. These 3.5" TFTs have very decent picture quality and are dirt cheap, plus this library seems to work great with the current official Adafruit GFX library. Awesome.

Just one thing, I spotted a typo. Pin D1 should go to PA1 and not to PC1.

User avatar
Dimdim
Posts: 8
Joined: Mon May 09, 2016 10:34 am
Location: Athens, Greece
Contact:

Re: Library ILI9481 320*480 3.5

Post by Dimdim » Sat Feb 25, 2017 11:43 pm

It seems that I spoke a little too soon here.

I'm running the graphicstest sketch and text in portrait looks OK but when it is rotated (landscape) it looks mirrored.

stevestrong
Posts: 1130
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Library ILI9481 320*480 3.5

Post by stevestrong » Sun Feb 26, 2017 9:23 am

mrmolano wrote:Hi

I modify the library of iwalpola the Adafruit ILI9341 8bit STM to work with the ILI9481, I leave the link from mega
https://mega.nz/#!59NmzIRA!EB3XwPoYjhPA ... XVYZB7A6iQ

bye
Thanks.
If you don't mind, I will add it to my lib which is designed to handle all 8 bit parallel displays using original Adafruit functions.

User avatar
Dimdim
Posts: 8
Joined: Mon May 09, 2016 10:34 am
Location: Athens, Greece
Contact:

Re: Library ILI9481 320*480 3.5

Post by Dimdim » Tue Feb 28, 2017 4:06 pm

Dimdim wrote:It seems that I spoke a little too soon here.

I'm running the graphicstest sketch and text in portrait looks OK but when it is rotated (landscape) it looks mirrored.
I took care of the above issue by replacing

Code: Select all

#define MADCTL_MY  0x80
#define MADCTL_MX  0x40
#define MADCTL_MV  0x20
#define MADCTL_ML  0x10
#define MADCTL_RGB 0x00
#define MADCTL_BGR 0x11
#define MADCTL_MH  0x04

void Adafruit_ILI9481_8bit_STM::setRotation(uint8_t m) {

  writecommand(ILI9481_MADCTL);
  rotation = m % 4; // can't be higher than 3
  switch (rotation) {
    case 0:
      writedata(MADCTL_MX | MADCTL_BGR);
      _width  = ILI9481_TFTWIDTH;
      _height = ILI9481_TFTHEIGHT;
      break;
    case 1:
      writedata(MADCTL_MV | MADCTL_BGR);
      _width  = ILI9481_TFTHEIGHT;
      _height = ILI9481_TFTWIDTH;
      break;
    case 2:
      writedata(MADCTL_MY | MADCTL_BGR);
      _width  = ILI9481_TFTWIDTH;
      _height = ILI9481_TFTHEIGHT;
      break;
    case 3:
      writedata(MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR);
      _width  = ILI9481_TFTHEIGHT;
      _height = ILI9481_TFTWIDTH;
      break;
  } 
}
with

Code: Select all

#define MADCTL_MY  0x80
#define MADCTL_MX  0x40
#define MADCTL_MV  0x20
#define MADCTL_ML  0x10
#define MADCTL_RGB 0x00
#define MADCTL_BGR 0x08
#define MADCTL_SS  0x02
#define MADCTL_GS  0x01

void Adafruit_ILI9481_8bit_STM::setRotation(uint8_t m) {

  writecommand(ILI9481_MADCTL);
  rotation = m % 4; // can't be higher than 3
  switch (rotation) {
    case 0:
      writedata(MADCTL_BGR | MADCTL_SS);
      _width  = ILI9481_TFTWIDTH;
      _height = ILI9481_TFTHEIGHT;
      break;
    case 1:
      writedata(MADCTL_MV | MADCTL_BGR);
      _width  = ILI9481_TFTHEIGHT;
      _height = ILI9481_TFTWIDTH;
      break;
    case 2:
      writedata(MADCTL_BGR | MADCTL_GS);
      _width  = ILI9481_TFTWIDTH;
      _height = ILI9481_TFTHEIGHT;
      break;
    case 3:
      writedata(MADCTL_MV | MADCTL_BGR | MADCTL_SS | MADCTL_GS);
      _width  = ILI9481_TFTHEIGHT;
      _height = ILI9481_TFTWIDTH;
      break;
  } 
}

matrixxx
Posts: 1
Joined: Sat Apr 08, 2017 9:55 am

Re: Library ILI9481 320*480 3.5

Post by matrixxx » Sat Apr 08, 2017 10:09 am

Hi all,

i am quite new to this, but i have already some arduino shileds here. Now im experimenting with the stm32f103c6. Especially for tft it might be faster than the mega...
I have this shield: https://www.mikrocontroller.net/attachm ... e_SPEC.pdf saying its a ili9481.. but i think its a HX8357B?!
or a
http://shop.boxtec.ch/tft-lcd-shield-fo ... 42762.html shield, which is more a ili9481.
..and a blue pill.

But i dont know which pin at the tftshield should go to which pin at the stm. touch is not necessary. Can you give me a quickstart somehow? Maybe SPI?

Thanks, Mike.

david.prentice
Posts: 78
Joined: Wed Nov 16, 2016 8:52 am

Re: Library ILI9481 320*480 3.5

Post by david.prentice » Sat Apr 08, 2017 12:14 pm

The first link says HX8357-B. So it seems likely to be HX8357-B but the Shield is write-only.
OTOH, recent "similar looking Shields" contain an ILI9481. The clue is written on the part number printed on the anti-static bag that the Shield came with.

The second Shield does contain ILI9481. And since that Shield is readable, you can confirm by reading reg(0xBF)

If you want to distinguish between HX8357-B and ILI9481, there are some minor differences in Manufacturer Registers.

David.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest