From 091c7858751965497bacf47adca5358148ef5dd5 Mon Sep 17 00:00:00 2001 From: Stephen White Date: Mon, 4 Jun 2018 19:11:15 +1000 Subject: [PATCH] Added option for to select what I2C bus to use. Also enabled the options file to be larger. --- src/main.cpp | 9 +++++---- src/options.cpp | 6 ++++++ src/options.h | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c4c8e2c..5d50628 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -80,7 +80,6 @@ const long int CBMFont_size = 4096; unsigned char CBMFontData[4096]; unsigned char* CBMFont = 0; -//u8 s_u8Memory[0x800]; u8 s_u8Memory[0xc000]; DiskCaddy diskCaddy; @@ -974,11 +973,11 @@ static void LoadOptions() { u32 bytesRead; SetACTLed(true); - f_read(&fp, tempBuffer, tempBufferSize, &bytesRead); + f_read(&fp, s_u8Memory, sizeof(s_u8Memory), &bytesRead); SetACTLed(false); f_close(&fp); - options.Process((char*)tempBuffer); + options.Process((char*)s_u8Memory); screenWidth = options.ScreenWidth(); screenHeight = options.ScreenHeight(); @@ -1150,10 +1149,12 @@ extern "C" CheckOptions(); + + int i2cBusMaster = options.I2CBusMaster(); if (strcasecmp(options.GetLCDName(), "ssd1306_128x64") == 0) { screenLCD = new ScreenLCD(); - screenLCD->Open(128, 64, 1, options.SplitIECLines() ? 1 : 0); + screenLCD->Open(128, 64, 1, i2cBusMaster); } else { diff --git a/src/options.cpp b/src/options.cpp index c7b2af8..46e078b 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -135,6 +135,7 @@ Options::Options(void) , ignoreReset(0) , screenWidth(1024) , screenHeight(768) + , i2cBusMaster(1) , keyboardBrowseLCDScreen(0) { strcpy(ROMFontName, "chargen"); @@ -187,6 +188,7 @@ void Options::Process(char* buffer) ELSE_CHECK_DECIMAL_OPTION(ignoreReset) ELSE_CHECK_DECIMAL_OPTION(screenWidth) ELSE_CHECK_DECIMAL_OPTION(screenHeight) + ELSE_CHECK_DECIMAL_OPTION(i2cBusMaster) ELSE_CHECK_DECIMAL_OPTION(keyboardBrowseLCDScreen) else if ((strcasecmp(pOption, "StarFileName") == 0)) { @@ -231,7 +233,11 @@ void Options::Process(char* buffer) } if (!SplitIECLines()) + { invertIECInputs = false; + // If using non split lines then only the 2nd bus master can be used (as ATN is using the 1st) + i2cBusMaster = 1; + } } unsigned Options::GetDecimal(char* pString) diff --git a/src/options.h b/src/options.h index f1d1ea9..a6160f9 100644 --- a/src/options.h +++ b/src/options.h @@ -65,6 +65,7 @@ public: inline unsigned int ScreenWidth() const { return screenWidth; } inline unsigned int ScreenHeight() const { return screenHeight; } + inline unsigned int I2CBusMaster() const { return i2cBusMaster; } // 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? @@ -93,6 +94,8 @@ private: unsigned int screenWidth; unsigned int screenHeight; + unsigned int i2cBusMaster; + unsigned int keyboardBrowseLCDScreen; char starFileName[256];