greiman / SSD1306Ascii

Text only Arduino Library for SSD1306 OLED displays
MIT License
499 stars 122 forks source link

Screen rotation #23

Open sticilface opened 7 years ago

sticilface commented 7 years ago

Is it possible to rotate the screen. i.e. have it 180 degrees?

greiman commented 7 years ago

No. It would require a second set of fonts of remapping the bits in each byte of the existing font which would be slow.

PBudmark commented 7 years ago

I would say yes, at least on my OLED 0.96" I2C-only. After normal initialization using Adafruit128x64, I send another two commands as I have my OLED rotated with the pins at bottom ` // Initialize dev from command table, turned on an cleared lcd.begin(&Adafruit128x64, I2C_ADDRESS);

// Rotate display 180 degrees, connection pins at bottom lcd.ssd1306WriteCmd(SSD1306_SEGREMAP); // colAddr 0 mapped to SEG0 (RESET) lcd.ssd1306WriteCmd(SSD1306_COMSCANINC); // Scan from COM0 to COM[N –1], normal (RESET) `

Evantm commented 6 years ago

In the library switch the values of COMSCANINC and COMSCANDEC. Like so: COMSCANINC = 0xc0 COMSCANDEC = 0xc8

https://electronics.stackexchange.com/questions/273768/flip-the-image-of-oled-128x64-0-96-inch-display

Vaclav-Benes commented 6 years ago

This worked for me. I am using 128x32 SSD1306 Oled.

You need to adjust 2 parameters in SSD1306init.h file under Adafruit 128x32.

From

SSD1306_SEGREMAP | 0x1, SSD1306_COMSCANDEC,

To

SSD1306_SEGREMAP | 0x0, SSD1306_COMSCANINC,

This fill flip the screen by 180 degrees. Hopes this works for you too.

greiman commented 6 years ago

I added void displayRemap(bool mode) to select normal or remap mode.

See the DisplayRotationSpi and DisplayRotationWire examples.