3.2" TFT rotation

Hi there,

Any help would be appreciated from someone with knowledge of the 3.2" TFT screen.

I’m currently using the TFT_HX8357 library. I’m trying to rotate the display by 180 degrees. I’ve tried all 8 possibilities for the tft.setRotation(e.g.0-7); command but none seem to rotate the display 180 degrees.

I’ve attached the library for reference.

Would anyone be able to assist please?

Thanks in advance,

Dave

TFT_HX8357.cpp (78.8 KB)

The 8 way rotation happens only if ILI9481 is defined. Is it? If not, there are only 4 rotations supported.

What happened when you tried each of the 4 or 8 options?

Hi Paul,

It wasn’t, but is now.

When trying the 8 various possibilities I get a variety of landscape/portrait as well as an inverted variant of each. What I’m not getting however is the landscape function I require.

Can you confirm that I simply need to #define ILI9481 as I have in my code please?

#include <User_Setup.h>
#include <TFT_HX8357.h> // Hardware-specific library
#include <avr/pgmspace.h>
#include "Free_Fonts.h" // Include the header file attached to this sketch

#define FM9  1
#define FM12 1
#define FMB9  1
#define FMB12 1

TFT_HX8357 tft = TFT_HX8357();       // Invoke custom library
//how many polls will be enough for one signal
#define MIN_PRESS_POLLS 100


//you mention 8 switches, so we go to this, but later on, we only define 7 and 8
#define SWITCH_COUNT 8
#define ILI9481 
//definition of the switch struct
struct switch_t {
  int port;
  int status;
  bool enabled;
  int hiState;
  int loState;
};

Paul,

Another thing I noticed in the library is in the attached screenshot. Part of it says I can rotate the screen 180 degrees, but it’s with ILI9486, and the comment suggests changing the library.

Please see attached.

Hi, I have not had experience with that screen I remember a friend of mine having the same problem with a different TFT screen We found a command that had portrait or landscape as its keywords.

Hope it helps.. Tom.. :)

Please see attached.

Why would you post pictures of text?

When trying the 8 various possibilities I get a variety of landscape/portrait as well as an inverted variant of each.

This isn't much help. What I want to see is a list of the 8 values, and a description of what "Hello" looks like with each value.

The screenshot showed that a comment has been made in the library which I assume means I can rotate the screen 180 degrees if I change one of the lines of code to writedata (0x42) from writedata 0x22.

So details of the problem:

tft.setRotation (0) - Portrait (inverted text) - same as options 0,2,4,6 tft.setRotation (1) - Landscape (normal text, just 180 degrees, or upside down for my application) tft.setRotation (2) - Portrait (inverted text) - same as options 0,2,4,6 tft.setRotation (3) - Landscape (normal text, just 180 degrees, or upside down for my application) tft.setRotation (4) - Portrait (inverted text) - same as options 0,2,4,6 tft.setRotation (5) - Landscape (normal text, just 180 degrees, or upside down for my application) tft.setRotation (6) - Portrait (inverted text) - same as options 0,2,4,6 tft.setRotation (7) - Landscape (normal text, just 180 degrees, or upside down for my application)

two screenshots attached to demonstrate the issue further

To all that helped,

I finally understood what PaulS was saying and defined the LI9486 driver in the library and set the rotation value to 7. This solved my issue.

Thanks again to PaulS for his help.