Added i2cLcdFlip = 0/1 to flip display 180 deg
This commit is contained in:
parent
1342ce812b
commit
0f536925bc
7 changed files with 21 additions and 10 deletions
|
@ -57,7 +57,7 @@ extern "C"
|
||||||
|
|
||||||
unsigned char frame[SSD1306_128x64_BYTES];
|
unsigned char frame[SSD1306_128x64_BYTES];
|
||||||
|
|
||||||
SSD1306::SSD1306(int BSCMaster, u8 address)
|
SSD1306::SSD1306(int BSCMaster, u8 address, int flip)
|
||||||
: BSCMaster(BSCMaster)
|
: BSCMaster(BSCMaster)
|
||||||
, address(address)
|
, address(address)
|
||||||
{
|
{
|
||||||
|
@ -73,9 +73,13 @@ SSD1306::SSD1306(int BSCMaster, u8 address)
|
||||||
|
|
||||||
SendCommand(SSD1306_CMD_SET_START_LINE | 0x0);
|
SendCommand(SSD1306_CMD_SET_START_LINE | 0x0);
|
||||||
|
|
||||||
SendCommand(0xA1); // Set Segment Re-Map
|
if (flip) {
|
||||||
|
SendCommand(0xA0); // No Segment Re-Map
|
||||||
SendCommand(0xC8); // Set COM Output Scan Direction
|
SendCommand(0xC0); // No COM Output Scan Direction
|
||||||
|
} else {
|
||||||
|
SendCommand(0xA1); // Set Segment Re-Map
|
||||||
|
SendCommand(0xC8); // Set COM Output Scan Direction
|
||||||
|
}
|
||||||
|
|
||||||
SendCommand(SSD1306_CMD_SET_COM_PINS); // Layout and direction
|
SendCommand(SSD1306_CMD_SET_COM_PINS); // Layout and direction
|
||||||
SendCommand(0x12);
|
SendCommand(0x12);
|
||||||
|
|
|
@ -72,7 +72,7 @@ class SSD1306
|
||||||
public:
|
public:
|
||||||
// 128x32 0x3C
|
// 128x32 0x3C
|
||||||
// 128x64 0x3D or 0x3C (if SA0 is grounded)
|
// 128x64 0x3D or 0x3C (if SA0 is grounded)
|
||||||
SSD1306(int BSCMaster = 1, u8 address = 0x3C);
|
SSD1306(int BSCMaster = 1, u8 address = 0x3C, int flip = 0);
|
||||||
|
|
||||||
void PlotCharacter(int x, int y, char ascii, bool inverse);
|
void PlotCharacter(int x, int y, char ascii, bool inverse);
|
||||||
void Plottext(int x, int y, char* str, bool inverse);
|
void Plottext(int x, int y, char* str, bool inverse);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
void ScreenLCD::Open(u32 widthDesired, u32 heightDesired, u32 colourDepth, int BSCMaster, int LCDAddress)
|
void ScreenLCD::Open(u32 widthDesired, u32 heightDesired, u32 colourDepth, int BSCMaster, int LCDAddress, int LCDFlip)
|
||||||
{
|
{
|
||||||
bpp = 1;
|
bpp = 1;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ void ScreenLCD::Open(u32 widthDesired, u32 heightDesired, u32 colourDepth, int B
|
||||||
width = widthDesired;
|
width = widthDesired;
|
||||||
height = heightDesired;
|
height = heightDesired;
|
||||||
|
|
||||||
ssd1306 = new SSD1306(BSCMaster, LCDAddress);
|
ssd1306 = new SSD1306(BSCMaster, LCDAddress, LCDFlip);
|
||||||
ssd1306->DisplayOn();
|
ssd1306->DisplayOn();
|
||||||
ssd1306->Plottext(5, 1, "Pi1541", false);
|
ssd1306->Plottext(5, 1, "Pi1541", false);
|
||||||
ssd1306->RefreshScreen();
|
ssd1306->RefreshScreen();
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Open(u32 width, u32 height, u32 colourDepth, int BSCMaster, int LCDAddress);
|
void Open(u32 width, u32 height, u32 colourDepth, int BSCMaster, int LCDAddress, int LCDFlip);
|
||||||
|
|
||||||
void ClearArea(u32 x1, u32 y1, u32 x2, u32 y2, RGBA colour);
|
void ClearArea(u32 x1, u32 y1, u32 x2, u32 y2, RGBA colour);
|
||||||
void Clear(RGBA colour);
|
void Clear(RGBA colour);
|
||||||
|
|
|
@ -1025,7 +1025,9 @@ static void CheckOptions()
|
||||||
screen.PrintText(false, 0, y_pos+=16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
screen.PrintText(false, 0, y_pos+=16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
||||||
snprintf(tempBuffer, tempBufferSize, "invertIECOutputs = %d\r\n", options.InvertIECOutputs());
|
snprintf(tempBuffer, tempBufferSize, "invertIECOutputs = %d\r\n", options.InvertIECOutputs());
|
||||||
screen.PrintText(false, 0, y_pos+=16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
screen.PrintText(false, 0, y_pos+=16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
||||||
snprintf(tempBuffer, tempBufferSize, "i2cBusAddress = %d\r\n", options.I2CLcdAddress());
|
snprintf(tempBuffer, tempBufferSize, "i2cLcdAddress = %d\r\n", options.I2CLcdAddress());
|
||||||
|
screen.PrintText(false, 0, y_pos+=16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
||||||
|
snprintf(tempBuffer, tempBufferSize, "i2cLcdFlip = %d\r\n", options.I2CLcdFlip());
|
||||||
screen.PrintText(false, 0, y_pos+=16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
screen.PrintText(false, 0, y_pos+=16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
||||||
IEC_Bus::WaitMicroSeconds(5 * 1000000);
|
IEC_Bus::WaitMicroSeconds(5 * 1000000);
|
||||||
}
|
}
|
||||||
|
@ -1166,10 +1168,11 @@ extern "C"
|
||||||
|
|
||||||
int i2cBusMaster = options.I2CBusMaster();
|
int i2cBusMaster = options.I2CBusMaster();
|
||||||
int i2cLcdAddress = options.I2CLcdAddress();
|
int i2cLcdAddress = options.I2CLcdAddress();
|
||||||
|
int i2cLcdFlip = options.I2CLcdFlip();
|
||||||
if (strcasecmp(options.GetLCDName(), "ssd1306_128x64") == 0)
|
if (strcasecmp(options.GetLCDName(), "ssd1306_128x64") == 0)
|
||||||
{
|
{
|
||||||
screenLCD = new ScreenLCD();
|
screenLCD = new ScreenLCD();
|
||||||
screenLCD->Open(128, 64, 1, i2cBusMaster, i2cLcdAddress);
|
screenLCD->Open(128, 64, 1, i2cBusMaster, i2cLcdAddress, i2cLcdFlip);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -141,6 +141,7 @@ Options::Options(void)
|
||||||
, screenHeight(768)
|
, screenHeight(768)
|
||||||
, i2cBusMaster(1)
|
, i2cBusMaster(1)
|
||||||
, i2cLcdAddress(0x3C)
|
, i2cLcdAddress(0x3C)
|
||||||
|
, i2cLcdFlip(0)
|
||||||
, keyboardBrowseLCDScreen(0)
|
, keyboardBrowseLCDScreen(0)
|
||||||
{
|
{
|
||||||
strcpy(ROMFontName, "chargen");
|
strcpy(ROMFontName, "chargen");
|
||||||
|
@ -204,6 +205,7 @@ void Options::Process(char* buffer)
|
||||||
ELSE_CHECK_DECIMAL_OPTION(screenHeight)
|
ELSE_CHECK_DECIMAL_OPTION(screenHeight)
|
||||||
ELSE_CHECK_DECIMAL_OPTION(i2cBusMaster)
|
ELSE_CHECK_DECIMAL_OPTION(i2cBusMaster)
|
||||||
ELSE_CHECK_DECIMAL_OPTION(i2cLcdAddress)
|
ELSE_CHECK_DECIMAL_OPTION(i2cLcdAddress)
|
||||||
|
ELSE_CHECK_DECIMAL_OPTION(i2cLcdFlip)
|
||||||
ELSE_CHECK_DECIMAL_OPTION(keyboardBrowseLCDScreen)
|
ELSE_CHECK_DECIMAL_OPTION(keyboardBrowseLCDScreen)
|
||||||
else if ((strcasecmp(pOption, "StarFileName") == 0))
|
else if ((strcasecmp(pOption, "StarFileName") == 0))
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,6 +70,7 @@ public:
|
||||||
|
|
||||||
inline unsigned int I2CBusMaster() const { return i2cBusMaster; }
|
inline unsigned int I2CBusMaster() const { return i2cBusMaster; }
|
||||||
inline unsigned int I2CLcdAddress() const { return i2cLcdAddress; }
|
inline unsigned int I2CLcdAddress() const { return i2cLcdAddress; }
|
||||||
|
inline unsigned int I2CLcdFlip() const { return i2cLcdFlip; }
|
||||||
|
|
||||||
// Page up and down will jump a different amount based on the maximum number rows displayed.
|
// Page up and down will jump a different amount based on the maximum number rows displayed.
|
||||||
// Perhaps we should use some keyboard modifier to the the other screen?
|
// Perhaps we should use some keyboard modifier to the the other screen?
|
||||||
|
@ -103,6 +104,7 @@ private:
|
||||||
|
|
||||||
unsigned int i2cBusMaster;
|
unsigned int i2cBusMaster;
|
||||||
unsigned int i2cLcdAddress;
|
unsigned int i2cLcdAddress;
|
||||||
|
unsigned int i2cLcdFlip;
|
||||||
|
|
||||||
unsigned int keyboardBrowseLCDScreen;
|
unsigned int keyboardBrowseLCDScreen;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue