cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f4 3.2'' ssd1289 tft orientation...

sts0340
Associate II
Posted on December 18, 2012 at 20:55

Hi all & seasons greetin's.

I have been using the HY32D 3.2'' TFT from China with the SSD1289.c and SSD1289.h library which I have had some nice results with thanks to MegaHercas.:)

I was wondering if anyone has any idea how to change the orientation of the screen from Horizontal to Vertical.. There is a small snippet of code in the .h file that give reference to: LCD_DIR_HORIZONTAL & LCD_DIR_VERTICAL but I have no idea within which of the functions it goes.. I've tried it in LCD_CLEAR but no result.

Have any of you clever people had success with this??

Otherwise it works very nicely.

Cheers 4 now!

Steve.

7 REPLIES 7
M0NKA
Senior
Posted on December 19, 2012 at 09:29

Hi,

I had a similar problem 2 weeks ago when i switched from the good old Nokia 7210 LCD

to HY28A with ILI9320 controller. It seems all the code is made for portrait mode (240W

\320H). Not sure if you have the same controller, but there are 3 significant registers that

control orientation, it is very important to read the pdf few times, just playing with the bit

values blind is not easy to get result.

Also if you use standard lib drawing routines - you might have to swap x and y on some

of them and for some - need to be coded from scratch.

BR

frankmeyer9
Associate II
Posted on December 19, 2012 at 09:59

You will definitely need to look at the SSD1289 datasheet.

There are usually some config registers, which define the orientation.

Those TFT driver chips are very similiar, often partially identical.

I could tell you how it's done on a HX8347D, but that would probably not help...

sts0340
Associate II
Posted on December 19, 2012 at 20:19

Hi! Thanks for the info. I've had a look @ the datasheet and found that command register 11 is the Entry Mode register. I've included attachments of the pages. I'm not entirely sure if I would need to change just this one register ( the AM bit ) or i am on the wrong track..?.. Would this be similar to the HX8347D??

________________

Attachments :

entryssd1289.bmp : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hzno&d=%2Fa%2F0X0000000bQA%2FcthlLcdGAO56qI6KvDkQRjg_rur9IUf_6HqqDRbJp0I&asPdf=false

entryssd2.bmp : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HznK&d=%2Fa%2F0X0000000bQ8%2F25HbSF1aUFJPLD4skuxA5uZMI6yWaYBiQWtsapU1wkY&asPdf=false
frankmeyer9
Associate II
Posted on December 19, 2012 at 20:42

I'm not entirely sure if I would need to change just this one register ( the AM bit )

 

I think so.

This far-east manuals are often a hard read. I'm not entirely new in this business, but the expression ''porch'' for the display orientation is new to me.

But if the code is working so far, you can experiment easily with different settings.

Not sure how you interface your display, but the ''windowing'' can speed up operations considerably. Setting a window of either height or width of 1 allows for fast line drawing, by just ''filling'' the colour into it. My display has a (hardwired) 8-bit bit/byte banging interface, so this method is much faster than setting pixels individually.

STM32 hobbyist
Associate III
Posted on August 06, 2013 at 23:05

Hi scutt;

I did have the same issue and solved it. So try the follwing modifs:

in SSD1289.h add:

#define DISP_ORIENTATION  90  /* angle 0 90 */ 

#if  ( DISP_ORIENTATION == 90 ) || ( DISP_ORIENTATION == 270 )

 #define  MAX_X  320

 #define  MAX_Y  240   

#elif  ( DISP_ORIENTATION == 0 ) || ( DISP_ORIENTATION == 180 )

 #define  MAX_X  240

 #define  MAX_Y  320   

#endif

in SSD1289.c modify the function: LCD_SetCursor():

void LCD_SetCursor(uint16_t Xpos, uint16_t Ypos)

{

#if  ( DISP_ORIENTATION == 90 ) || ( DISP_ORIENTATION == 270 )

      uint16_t temp = Xpos;

       Xpos = Ypos;

       Ypos = ( MAX_X - 1 ) - temp;  

#endif

       LCD_WriteReg(0x004e, Xpos );      

       LCD_WriteReg(0x004f, Ypos );          

}

If you want to change the orientation, you should modify the define: 

#define DISP_ORIENTATION  90 /* 0, 90, 180 or 270 degree */

Hope this helps 😉

STM32

angeletti
Associate II
Posted on October 19, 2013 at 15:36

I've just received a similar lcd with ssd1289 controller, can i ask you for code? is it requiring an external ram chip?

Fabio

Posted on October 19, 2013 at 17:19

is it requiring an external ram chip?

It has an internal

http://www.solomon-systech.com/en/product/display-ic/smart-tft-lcd-driver-controller/ssd1289/

, so beyond any bitmaps/textures probably not.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..