Library to control a Graphics TFT connected to 4-wire SPI - revised for the Raio RA8875 Display Controller.

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

Issue: Code doesn't rotate display (Closed: Fixed)

I have an 8875-based design and I have been trying to figure out from the datasheet how to rotate the display when I searched and found this code. I was dubious as I read the bits in the registers being written and the intended effect they would have on the display but I tried the code anyway. The result is exactly as I expected. It is possible to flip the display 180 but not 90 or 270. They simply do not work and I don't believe that there is a way to make them work in hardware. I hope to be proven wrong.

2 comments:

16 Mar 2017

Sorry I didn't see this before, the mbed system didn't notify me...

Please see the simple example for SetOrientation

I am reasonably confident it worked as documented. If you feel it doesn't, please let me know what display (resolution) you have, and which rotations worked, etc. A small sample of code would be most appreciated to help me focus specifically on this.

17 Mar 2017

I just ran a test, and screen rotation works fine. This was on a 480 x 272 display. Below is the exact program I used.

Just to be clear, this is not "font rotation". In other words, I do not have a means to write text onto a single screen with both horizontal and vertical orientation. This is a screen rotation which completely changes the orientation of the lcd control.

Please make sure your library is version 100 or newer (when some changes for rotation were made). I tested this with the latest (v141).

#include "mbed.h"           // v122
#include "RA8875.h"         // v125

RA8875 lcd(p5, p6, p7, p12, NC, "tft");

#define LCD_C 16         // color - bits per pixel
#define LCD_W 480
#define LCD_H 272

int main()
{
    lcd.init(LCD_W, LCD_H, LCD_C);
    lcd.Backlight(0.5f);

    lcd.cls();
    lcd.SetOrientation(RA8875::normal);
    lcd.puts(30,30, "Normal Landscape");
    wait_ms(2500);
    
    lcd.cls();
    lcd.SetOrientation(RA8875::rotate_90);
    lcd.puts(30,30, "Rotated 90 Text\r\n");
    wait_ms(2500);
    
    lcd.cls();
    lcd.SetOrientation(RA8875::rotate_180);
    lcd.puts(30,30, "Rotated 180 Text\r\n");
    wait_ms(2500);

    lcd.cls();
    lcd.SetOrientation(RA8875::rotate_270);
    lcd.puts(30,30, "Rotated 270 Text\r\n");
    wait_ms(2500);

    while(1) {
        ;       // end
    }
}