Merge branch 'early_oled' of https://github.com/penfold42/Pi1541 into penfold42-early_oled
This commit is contained in:
parent
270650751c
commit
99ddf7c31f
3 changed files with 55 additions and 47 deletions
86
src/main.cpp
86
src/main.cpp
|
@ -343,6 +343,31 @@ void InitialiseHardware()
|
||||||
RPI_PropertyProcess();
|
RPI_PropertyProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InitialiseLCD()
|
||||||
|
{
|
||||||
|
int i2cBusMaster = options.I2CBusMaster();
|
||||||
|
int i2cLcdAddress = options.I2CLcdAddress();
|
||||||
|
int i2cLcdFlip = options.I2CLcdFlip();
|
||||||
|
int i2cLcdOnContrast = options.I2CLcdOnContrast();
|
||||||
|
int i2cLcdDimContrast = options.I2CLcdDimContrast();
|
||||||
|
int i2cLcdDimTime = options.I2CLcdDimTime();
|
||||||
|
if (strcasecmp(options.GetLCDName(), "ssd1306_128x64") == 0)
|
||||||
|
{
|
||||||
|
screenLCD = new ScreenLCD();
|
||||||
|
screenLCD->Open(128, 64, 1, i2cBusMaster, i2cLcdAddress, i2cLcdFlip, 1306);
|
||||||
|
screenLCD->SetContrast(i2cLcdOnContrast);
|
||||||
|
}
|
||||||
|
else if (strcasecmp(options.GetLCDName(), "sh1106_128x64") == 0)
|
||||||
|
{
|
||||||
|
screenLCD = new ScreenLCD();
|
||||||
|
screenLCD->Open(128, 64, 1, i2cBusMaster, i2cLcdAddress, i2cLcdFlip, 1106);
|
||||||
|
screenLCD->SetContrast(i2cLcdOnContrast);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//void UpdateUartControls(bool refreshStatusDisplay, bool LED, bool Motor, bool ATN, bool DATA, bool CLOCK, u32 Track, u32 romIndex)
|
//void UpdateUartControls(bool refreshStatusDisplay, bool LED, bool Motor, bool ATN, bool DATA, bool CLOCK, u32 Track, u32 romIndex)
|
||||||
//{
|
//{
|
||||||
// //InputMappings* inputMappings = InputMappings::Instance();
|
// //InputMappings* inputMappings = InputMappings::Instance();
|
||||||
|
@ -994,25 +1019,9 @@ static void LoadOptions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CheckOptions()
|
void DisplayOptions(int y_pos)
|
||||||
{
|
{
|
||||||
FIL fp;
|
|
||||||
FRESULT res;
|
|
||||||
|
|
||||||
u32 widthText, heightText;
|
|
||||||
u32 widthScreen = screen.Width();
|
|
||||||
u32 heightScreen = screen.Height();
|
|
||||||
u32 xpos, ypos;
|
|
||||||
const char* ROMName;
|
|
||||||
|
|
||||||
deviceID = (u8)options.GetDeviceID();
|
|
||||||
DEBUG_LOG("DeviceID = %d\r\n", deviceID);
|
|
||||||
|
|
||||||
|
|
||||||
// print confirmation of parsed options
|
// print confirmation of parsed options
|
||||||
if (0) {
|
|
||||||
screen.Clear(COLOUR_BLACK);
|
|
||||||
int y_pos = 200;
|
|
||||||
snprintf(tempBuffer, tempBufferSize, "ignoreReset = %d\r\n", options.IgnoreReset());
|
snprintf(tempBuffer, tempBufferSize, "ignoreReset = %d\r\n", options.IgnoreReset());
|
||||||
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, "RAMBOard = %d\r\n", options.GetRAMBOard());
|
snprintf(tempBuffer, tempBufferSize, "RAMBOard = %d\r\n", options.GetRAMBOard());
|
||||||
|
@ -1029,9 +1038,22 @@ 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, "LCDName = %s\r\n", options.GetLCDName());
|
snprintf(tempBuffer, tempBufferSize, "LCDName = %s\r\n", options.GetLCDName());
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CheckOptions()
|
||||||
|
{
|
||||||
|
FIL fp;
|
||||||
|
FRESULT res;
|
||||||
|
|
||||||
|
u32 widthText, heightText;
|
||||||
|
u32 widthScreen = screen.Width();
|
||||||
|
u32 heightScreen = screen.Height();
|
||||||
|
u32 xpos, ypos;
|
||||||
|
const char* ROMName;
|
||||||
|
|
||||||
|
deviceID = (u8)options.GetDeviceID();
|
||||||
|
DEBUG_LOG("DeviceID = %d\r\n", deviceID);
|
||||||
|
|
||||||
ROMName = options.GetRomFontName();
|
ROMName = options.GetRomFontName();
|
||||||
if (ROMName)
|
if (ROMName)
|
||||||
{
|
{
|
||||||
|
@ -1131,6 +1153,9 @@ extern "C"
|
||||||
write32(ARM_GPIO_GPCLR0, 0xFFFFFFFF);
|
write32(ARM_GPIO_GPCLR0, 0xFFFFFFFF);
|
||||||
|
|
||||||
DisplayLogo();
|
DisplayLogo();
|
||||||
|
|
||||||
|
InitialiseLCD();
|
||||||
|
|
||||||
int y_pos = 184;
|
int y_pos = 184;
|
||||||
snprintf(tempBuffer, tempBufferSize, "Copyright(C) 2018 Stephen White");
|
snprintf(tempBuffer, tempBufferSize, "Copyright(C) 2018 Stephen White");
|
||||||
screen.PrintText(false, 0, y_pos+=16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
screen.PrintText(false, 0, y_pos+=16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
||||||
|
@ -1139,6 +1164,8 @@ extern "C"
|
||||||
snprintf(tempBuffer, tempBufferSize, "This is free software, and you are welcome to redistribute it.");
|
snprintf(tempBuffer, tempBufferSize, "This is free software, and you are welcome to redistribute it.");
|
||||||
screen.PrintText(false, 0, y_pos+=16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
screen.PrintText(false, 0, y_pos+=16, tempBuffer, COLOUR_WHITE, COLOUR_BLACK);
|
||||||
|
|
||||||
|
if (options.ShowOptions())
|
||||||
|
DisplayOptions(y_pos+32);
|
||||||
|
|
||||||
if (!options.QuickBoot())
|
if (!options.QuickBoot())
|
||||||
IEC_Bus::WaitMicroSeconds(3 * 1000000);
|
IEC_Bus::WaitMicroSeconds(3 * 1000000);
|
||||||
|
@ -1165,29 +1192,6 @@ extern "C"
|
||||||
|
|
||||||
CheckOptions();
|
CheckOptions();
|
||||||
|
|
||||||
|
|
||||||
int i2cBusMaster = options.I2CBusMaster();
|
|
||||||
int i2cLcdAddress = options.I2CLcdAddress();
|
|
||||||
int i2cLcdFlip = options.I2CLcdFlip();
|
|
||||||
int i2cLcdOnContrast = options.I2CLcdOnContrast();
|
|
||||||
int i2cLcdDimContrast = options.I2CLcdDimContrast();
|
|
||||||
int i2cLcdDimTime = options.I2CLcdDimTime();
|
|
||||||
if (strcasecmp(options.GetLCDName(), "ssd1306_128x64") == 0)
|
|
||||||
{
|
|
||||||
screenLCD = new ScreenLCD();
|
|
||||||
screenLCD->Open(128, 64, 1, i2cBusMaster, i2cLcdAddress, i2cLcdFlip, 1306);
|
|
||||||
screenLCD->SetContrast(i2cLcdOnContrast);
|
|
||||||
}
|
|
||||||
else if (strcasecmp(options.GetLCDName(), "sh1106_128x64") == 0)
|
|
||||||
{
|
|
||||||
screenLCD = new ScreenLCD();
|
|
||||||
screenLCD->Open(128, 64, 1, i2cBusMaster, i2cLcdAddress, i2cLcdFlip, 1106);
|
|
||||||
screenLCD->SetContrast(i2cLcdOnContrast);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
IEC_Bus::SetSplitIECLines(options.SplitIECLines());
|
IEC_Bus::SetSplitIECLines(options.SplitIECLines());
|
||||||
IEC_Bus::SetInvertIECInputs(options.InvertIECInputs());
|
IEC_Bus::SetInvertIECInputs(options.InvertIECInputs());
|
||||||
IEC_Bus::SetInvertIECOutputs(options.InvertIECOutputs());
|
IEC_Bus::SetInvertIECOutputs(options.InvertIECOutputs());
|
||||||
|
|
|
@ -129,6 +129,7 @@ Options::Options(void)
|
||||||
, supportUARTInput(0)
|
, supportUARTInput(0)
|
||||||
, graphIEC(0)
|
, graphIEC(0)
|
||||||
, quickBoot(0)
|
, quickBoot(0)
|
||||||
|
, showOptions(0)
|
||||||
, displayPNGIcons(0)
|
, displayPNGIcons(0)
|
||||||
, soundOnGPIO(0)
|
, soundOnGPIO(0)
|
||||||
, soundOnGPIODuration(1000)
|
, soundOnGPIODuration(1000)
|
||||||
|
@ -193,6 +194,7 @@ void Options::Process(char* buffer)
|
||||||
ELSE_CHECK_DECIMAL_OPTION(supportUARTInput)
|
ELSE_CHECK_DECIMAL_OPTION(supportUARTInput)
|
||||||
ELSE_CHECK_DECIMAL_OPTION(graphIEC)
|
ELSE_CHECK_DECIMAL_OPTION(graphIEC)
|
||||||
ELSE_CHECK_DECIMAL_OPTION(quickBoot)
|
ELSE_CHECK_DECIMAL_OPTION(quickBoot)
|
||||||
|
ELSE_CHECK_DECIMAL_OPTION(showOptions)
|
||||||
ELSE_CHECK_DECIMAL_OPTION(displayPNGIcons)
|
ELSE_CHECK_DECIMAL_OPTION(displayPNGIcons)
|
||||||
ELSE_CHECK_DECIMAL_OPTION(soundOnGPIO)
|
ELSE_CHECK_DECIMAL_OPTION(soundOnGPIO)
|
||||||
ELSE_CHECK_DECIMAL_OPTION(soundOnGPIODuration)
|
ELSE_CHECK_DECIMAL_OPTION(soundOnGPIODuration)
|
||||||
|
|
|
@ -56,6 +56,7 @@ public:
|
||||||
|
|
||||||
inline unsigned int GraphIEC() const { return graphIEC; }
|
inline unsigned int GraphIEC() const { return graphIEC; }
|
||||||
inline unsigned int QuickBoot() const { return quickBoot; }
|
inline unsigned int QuickBoot() const { return quickBoot; }
|
||||||
|
inline unsigned int ShowOptions() const { return showOptions; }
|
||||||
inline unsigned int DisplayPNGIcons() const { return displayPNGIcons; }
|
inline unsigned int DisplayPNGIcons() const { return displayPNGIcons; }
|
||||||
inline unsigned int SoundOnGPIO() const { return soundOnGPIO; }
|
inline unsigned int SoundOnGPIO() const { return soundOnGPIO; }
|
||||||
inline unsigned int SoundOnGPIODuration() const { return soundOnGPIODuration; }
|
inline unsigned int SoundOnGPIODuration() const { return soundOnGPIODuration; }
|
||||||
|
@ -93,6 +94,7 @@ private:
|
||||||
unsigned int supportUARTInput;
|
unsigned int supportUARTInput;
|
||||||
unsigned int graphIEC;
|
unsigned int graphIEC;
|
||||||
unsigned int quickBoot;
|
unsigned int quickBoot;
|
||||||
|
unsigned int showOptions;
|
||||||
unsigned int displayPNGIcons;
|
unsigned int displayPNGIcons;
|
||||||
unsigned int soundOnGPIO;
|
unsigned int soundOnGPIO;
|
||||||
unsigned int soundOnGPIODuration;
|
unsigned int soundOnGPIODuration;
|
||||||
|
|
Loading…
Reference in a new issue