Library ILI9481 320*480 3.5

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

Library ILI9481 320*480 3.5

Postby 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!EB3XwPoYjhPAkv8yNL5GJLs2aZGuHgBSwXVYZB7A6iQ

bye

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

Re: Library ILI9481 320*480 3.5

Postby 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

Postby 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

Postby 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: 722
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Library ILI9481 320*480 3.5

Postby 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!EB3XwPoYjhPAkv8yNL5GJLs2aZGuHgBSwXVYZB7A6iQ

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

Postby 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;
  }
}


Return to “Libraries & Hardware”

Who is online

Users browsing this forum: No registered users and 3 guests