SH1106 support now works

This commit is contained in:
penfold42 2018-07-16 22:46:53 +10:00
parent e34274c01e
commit 91ead26b2b
3 changed files with 6 additions and 33 deletions

View file

@ -65,7 +65,7 @@ void SSD1306::InitHardware()
SetContrast(GetContrast());
SendCommand(SSD1306_CMD_ENTIRE_DISPLAY_ON); // 0xA4 - DONT force entire display on
SendCommand(SSD1306_CMD_TEST_DISPLAY_OFF); // 0xA4 - DONT force entire display on
SendCommand(SSD1306_CMD_NORMAL_DISPLAY); // 0xA6 = non inverted
@ -129,14 +129,6 @@ void SSD1306::MoveCursorByte(u8 row, u8 col)
SendCommand(0x10 | (col >> 4)); // column address upper bits
}
void SSD1306::MoveCursorCharacter(u8 row, u8 col)
{
if (col > 15) { col = 15; }
if (row > 7) { row = 7; }
MoveCursorByte(row, col << 3);
}
void SSD1306::RefreshScreen()
{
int i;
@ -146,36 +138,17 @@ void SSD1306::RefreshScreen()
}
}
/*
void SSD1306::RefreshRows(u32 start, u32 numRows)
{
start <<=1;
numRows <<=1;
int i;
for (i = start; i < numRows; i++)
u32 i;
for (i = start; i < start+numRows; i++)
{
RefreshPage(i);
}
}
*/
void SSD1306::RefreshRows(u32 start, u32 amountOfRows)
{
int i;
start <<= 1;
amountOfRows <<= 1;
MoveCursorCharacter(start, 0);
start *= 128;
int end = start + amountOfRows * 128;
for (i = start; i < end; i++)
{
SendData(frame[i]);
}
}
void SSD1306::RefreshPage(u32 page)
{
MoveCursorByte(page, 0);

View file

@ -102,7 +102,6 @@ protected:
void Home();
void MoveCursorByte(u8 row, u8 col);
void MoveCursorCharacter(u8 row, u8 col);
unsigned char frame[SSD1306_128x64_BYTES];
@ -122,8 +121,8 @@ protected:
#define SSD1306_CMD_ACTIVATE_SCROLL 0x2F
#define SSD1306_CMD_SET_CONTRAST_CONTROL 0x81 // Set Contrast Control for BANK0
#define SSD1306_ENABLE_CHARGE_PUMP 0x8D
#define SSD1306_CMD_ENTIRE_DISPLAY_ON 0xA4
#define SSD1306_CMD_ENTIRE_DISPLAY_OFF 0xA5
#define SSD1306_CMD_TEST_DISPLAY_OFF 0xA4
#define SSD1306_CMD_TEST_DISPLAY_ON 0xA5
#define SSD1306_CMD_NORMAL_DISPLAY 0xA6 // 1 = on pixel
#define SSD1306_CMD_INVERT_DISPLAY 0xA7 // 0 = on pixel
#define SSD1306_CMD_DISPLAY_OFF 0xAE

View file

@ -372,6 +372,7 @@ void InitialiseLCD()
screenLCD = new ScreenLCD();
screenLCD->Open(128, 64, 1, i2cBusMaster, i2cLcdAddress, i2cLcdFlip, i2cLcdModel);
screenLCD->SetContrast(i2cLcdOnContrast);
screenLCD->ClearInit(0);
bool logo_done = false;
if (strcasecmp(options.GetLcdLogoName(), "1541ii") == 0)