Does anyone know if it's possible to flip (over x and y axis, ie: rotate 180 degrees) the SSD1306 display while still keeping it in horizontal addressing mode? I know I can do some transforms in my display function but I thought there may be an easier way. I modified the adafruit driver to not use a 1kB buffer so it wouldn't be as straight forward.
Thanks,
Elliot
SSD1306 flip lcd
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 2
- Joined: Tue Jan 10, 2012 12:49 am
Re: SSD1306 flip lcd
I figured it out after posting this. I was updating the wrong copy of the library which is why it wasn't working before. For other peoples reference here is what I changed:
//ssd1306_command(SSD1306_SEGREMAP | 0x1);
ssd1306_command(SSD1306_SEGREMAP);
//ssd1306_command(SSD1306_COMSCANDEC);
ssd1306_command(SSD1306_COMSCANINC);
This came in handy for me because it was a lot easier to lay my board out with the lcd upside down.
Regards,
Elliot
//ssd1306_command(SSD1306_SEGREMAP | 0x1);
ssd1306_command(SSD1306_SEGREMAP);
//ssd1306_command(SSD1306_COMSCANDEC);
ssd1306_command(SSD1306_COMSCANINC);
This came in handy for me because it was a lot easier to lay my board out with the lcd upside down.
Regards,
Elliot
-
- Posts: 11
- Joined: Mon Jan 02, 2012 3:25 pm
Re: SSD1306 flip lcd
elliotb wrote:Does anyone know if it's possible to flip (over x and y axis, ie: rotate 180 degrees) the SSD1306 display while still keeping it in horizontal addressing mode? I know I can do some transforms in my display function but I thought there may be an easier way. I modified the adafruit driver to not use a 1kB buffer so it wouldn't be as straight forward.
Thanks,
Elliot
Hi Elliot,
Do you have the modified code to not use the buffer? I am running into memory issues with my project and its because of the 1k buffer.
- tomcat
- Posts: 30
- Joined: Thu Jan 26, 2012 9:50 am
Re: SSD1306 flip lcd
Hi Eliot:
Is there an easy way for me to swap x and y axises (sp?), my orientation needs to be altered 90 degrees.
Thanks.
Is there an easy way for me to swap x and y axises (sp?), my orientation needs to be altered 90 degrees.
Thanks.
- nyukin
- Posts: 8
- Joined: Tue Jan 25, 2011 5:25 am
Re: SSD1306 flip lcd
Elliot - This worked for me as well. I ran into trouble for a moment because I didn't realize there were actually two instances of each of the line changes described above, but now it works as expected. Thanks for sharing how you did it after you figured it out.elliotb wrote:I figured it out after posting this. I was updating the wrong copy of the library which is why it wasn't working before. For other peoples reference here is what I changed:
//ssd1306_command(SSD1306_SEGREMAP | 0x1);
ssd1306_command(SSD1306_SEGREMAP);
//ssd1306_command(SSD1306_COMSCANDEC);
ssd1306_command(SSD1306_COMSCANINC);
This came in handy for me because it was a lot easier to lay my board out with the lcd upside down.
Regards,
Elliot
mirage00 - I suspect Elliot and I are using the same library for our OLEDs. I found it here:https://code.google.com/p/beta-lib/down ... p&can=2&q=. In addition to not handling graphics, I also found that text does not wrap with this library, so lines of text > 21 characters (with the 5x7 font) go off into space and don't come back. These tradeoffs are offset by the awesome > 500 bytes of RAM I recovered in my sketch. For my project I addressed this within my sketch. I'll post some example code I wrote to create a serial link to the display that handles word wrap, the return key, and the backspace key.mirage00 wrote:
Hi Elliot,
Do you have the modified code to not use the buffer? I am running into memory issues with my project and its because of the 1k buffer.
Code: Select all
/*
Demo of the SSD1306 character only library
Circuit is defined below in OLED pin definitions
Create a serial link, handle word wrap and return/backspace
*/
#include <SSD1306ASCII.h>
// pin definitions
#define OLED_DATA 2
#define OLED_CLK 3
#define OLED_DC 4
#define OLED_RST 5
#define OLED_CS 6
// instantiate oled at defined pins
SSD1306ASCII oled(OLED_DATA, OLED_CLK, OLED_DC, OLED_RST, OLED_CS);
int row = 0; // variable will change
int column = 0; // variable will change
//----------
void setup()
{
oled.ssd1306_init(SSD1306_SWITCHCAPVCC); // high voltage
oled.clear();
oled.setCursor(3,4);
oled.print("Display link up!");
delay(2000);
oled.clear();
oled.setCursor(0,0);
Serial.begin(19200);
}
//---------
void loop()
{
// variables for displaying text
int i = 0;
char someChar[32] = {0};
// display input and wrap text
if(Serial.available())
{
do
{
someChar[i++] = Serial.read();
} while (Serial.available());
// handle the return key
if (strcmp(someChar, "\r") == 0)
{
row++;
column = 0;
}
// handle the backspace key
else if (strcmp(someChar, "\b") == 0)
{
if ((column) + (row) == 0)
{
oled.print(" ");
}
else if (column == 0)
{
row--;
column = 20;
}
else
{
column--;
}
oled.setCursor(column,row);
oled.print(" ");
}
// print char and advance cursor
else
{
oled.print(someChar);
column++;
}
if (column > 20)
{
row++;
column = 0;
}
if (row > 7)
{
oled.clear();
row=0;
}
// set cursor for next char
oled.setCursor(column,row);
}
// add more code here
}
Please be positive and constructive with your questions and comments.