Added option for to select what I2C bus to use.

Also enabled the options file to be larger.
This commit is contained in:
Stephen White 2018-06-04 19:11:15 +10:00
parent 823ced5be9
commit 091c785875
3 changed files with 14 additions and 4 deletions

View File

@ -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
{

View File

@ -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)

View File

@ -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];