Rotate and reverse characters in LCD display

I have a 128x64 LCD display and I want to rotate the text so the display can be read from the other side. Basically the character would have to be inverted, then displayed right to left. See attached images.

I'm using this library: GitHub - adafruit/ST7565-LCD: There are two 'versions' of the LCD library - one is straightup avr-gcc and the other is an Arduino Library. They're essentially the same. You can create new icons for bitmapdisplaying using bmp2glcd have fun! limor

The function that displays character is below. Can someone tell me what changes to the code I can make to get the text to flip?

void ST7565::drawchar(uint8_t x, uint8_t line, char c) {
  for (uint8_t i =0; i<5; i++ ) {
    st7565_buffer[x + (line*128) ] = pgm_read_byte(font+(c*5)+i);
    x++;
  }
  updateBoundingBox(x, line*8, x+5, line*8 + 8);
}

LCD Text 2.jpg

LCD Text 1.jpg

Not sure if it's that easy, but maybe like this:

change everywhere you see "x", to "(128 - x)"
and everywhere you see "line", to "(8 - line)"

It's probably not only this, but it's a start :slight_smile:

It should reverse lines and character positions, but not the character itself, you have to try things to get the desired result :slight_smile:

pgm_read_byte(font+(c*5)+i);

This tells you that the character definitions are stored in an array called font.

You need to look at what the bit patterns in there are and then create the new bit pattern (reversed and upside down) either on the fly when you need to display or as a new font table.

The normal LCD libraries allow you to have text going right to left instead of the normal left to right. Combine the two and you should have what you need.

An alternative is to just mount the LCD display upside down :slight_smile: