Author Topic: Rotate the display on the OLED screen  (Read 16738 times)

gladoscc

  • Newbie
  • *
  • Posts: 4
Rotate the display on the OLED screen
« on: January 19, 2015, 11:32:48 pm »
I need to rotate the OLED screen by 180 degrees. I've searched and found that I should change

4th byte sent: 0xB0 to 0xA0
5th byte sent: 0xC8 to 0xC0

in the ssd1306_init_sequence[] of DigisparkOLED.cpp

However, all this does is make the display "bottom to top", without flipping the x axis or flipping the y axis. How can I rotate the display 180 degrees?

defragster

  • Sr. Member
  • ****
  • Posts: 467
Re: Rotate the display on the OLED screen
« Reply #1 on: January 20, 2015, 03:28:02 am »
Not sure where I got my copy of this PDF : http://www.scribd.com/doc/251042421/Ssd-1306#scribd

I found a vertical flip:
Code: [Select]
oled.ssd1306_send_command( ((0xc8) >> 8) | 0xc0 );  // send command Set COM Output Scan Direction (C0h/C8h)
This puts into HUD mode, that is flipped 180 and mirrored.  Not fun to look at.  This shows up as a side effect of  bugs in the current (1.5.8C) code (updated on GitHub now for next release) if you see it while wrapping text.

10.1.14 Set COM Output Scan Direction (C0h/C8h)
This command sets the scan direction of the COM output, allowing layout flexibility in the OLED module
design. Additionally, the display will show once this command is issued. For example, if this command is
sent during normal display then the graphic display will be vertically flipped immediately. Please refer to
Table 10-3 for details.

I found this if you like black on white text - maybe you want to use the OLED as a white LED or catch your attention:
Code: [Select]
oled.ssd1306_send_command( 0xa7 );  // send command 0xa6 Set Normal/ 0xa7 Inverse Display (A6h/A7h)Very fast and preserves screen content but inverts the whole display, when blinking the LED won't do.
« Last Edit: January 20, 2015, 03:30:21 am by defragster »

gladoscc

  • Newbie
  • *
  • Posts: 4
Re: Rotate the display on the OLED screen
« Reply #2 on: January 21, 2015, 06:31:27 pm »
The first command is almost useful, I just need to flip the x axis now to make it rotated by 180 degrees. Is there a command to do that?

defragster

  • Sr. Member
  • ****
  • Posts: 467
Re: Rotate the display on the OLED screen
« Reply #3 on: January 21, 2015, 11:12:41 pm »
Not in my reading of the linked manual - if you find it please post.

selcuksarii

  • Newbie
  • *
  • Posts: 1
Re: Rotate the display on the OLED screen
« Reply #4 on: January 30, 2016, 12:54:52 am »
Old but maybe someone needs, using either option 1 or 2 rotates the display 180 degree on my board.
Segment Remap - COM Output
1- A0-C0
2- A8-C8

kripacharya

  • Newbie
  • *
  • Posts: 1
Re: Rotate the display on the OLED screen
« Reply #5 on: June 14, 2016, 07:13:33 am »
There is a lot of code & ideas for flipping vertically the SSD1306 display, but the simplest possible method using SSD1306 command only is pointed to by selcuksarii and gladoscc above, though they are both incorrect.
 
Correct ones are :

option (1) use command combo A0 and C0 --> upright with pins below
option (2) use command combo A1 and C8 --> upright with pins above

( Note : corrections - A8 should be A1. And B0 should be C0 )

Thats it!
« Last Edit: June 14, 2016, 07:19:11 am by kripacharya »