How can I change the orientation (landscape/portrait) of a SWIM project?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I change the orientation (landscape/portrait) of a SWIM project?

1,069 Views
lpcware-support
Senior Contributor I

SWIM only works in the native display’s memory format and won’t write in landscape format on a portrait frame buffer configuration.

However, as a workaround, you can generate a dummy frame buffer in landscape format and use SWIM to write to that and then occasionally copy that buffer to the real portrait frame buffer, reorganizing the pixels in the copy. This won’t be fast, but it will allow evaluation of SWIM in landscape mode.

Something like this:
uint16_t dummy_fb[320][240];
uint16_t real_fb[240][ 320];
LCD->CURRFB = real_fb;

/* Setup SWIM with dummy_fb */

/* periodically call this */
void move_dummy_fb_to_real_fb(void)
{
    int x, y;

    for (x = 0; x < 320; x++) {
        for (y = 0; y < 240; y++) {
            real_fb[y][x] = dummy_fb[x][y];
        }
    }
}

Labels (1)
Tags (1)
0 Kudos
Reply
0 Replies