Merge branch 'master' into cleanup
This commit is contained in:
commit
ddfcdbe50b
15 changed files with 239 additions and 149 deletions
|
@ -352,7 +352,7 @@ Drive::Drive() : m_pVIA(0)
|
||||||
|
|
||||||
void Drive::Reset()
|
void Drive::Reset()
|
||||||
{
|
{
|
||||||
headTrackPos = 34; // Start with the head over track 18
|
headTrackPos = 0; // Start with the head over track 19 (Very later Vorpal ie Cakifornia Games) need to have had the last head movement -ve
|
||||||
CLOCK_SEL_AB = 3; // Track 18 will use speed zone 3 (encoder/decoder (ie UE7Counter) clocked at 1.2307Mhz)
|
CLOCK_SEL_AB = 3; // Track 18 will use speed zone 3 (encoder/decoder (ie UE7Counter) clocked at 1.2307Mhz)
|
||||||
UpdateHeadSectorPosition();
|
UpdateHeadSectorPosition();
|
||||||
lastHeadDirection = 0;
|
lastHeadDirection = 0;
|
||||||
|
@ -390,8 +390,9 @@ void Drive::DumpTrack(unsigned track)
|
||||||
void Drive::OnPortOut(void* pThis, unsigned char status)
|
void Drive::OnPortOut(void* pThis, unsigned char status)
|
||||||
{
|
{
|
||||||
Drive* pDrive = (Drive*)pThis;
|
Drive* pDrive = (Drive*)pThis;
|
||||||
pDrive->motor = (status & 4) != 0;
|
if (pDrive->motor)
|
||||||
pDrive->MoveHead(status & 3);
|
pDrive->MoveHead(status & 3);
|
||||||
|
pDrive->motor = (status & 4) != 0;
|
||||||
pDrive->CLOCK_SEL_AB = ((status >> 5) & 3);
|
pDrive->CLOCK_SEL_AB = ((status >> 5) & 3);
|
||||||
pDrive->LED = (status & 8) != 0;
|
pDrive->LED = (status & 8) != 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,6 +385,7 @@ FileBrowser::FileBrowser(DiskCaddy* diskCaddy, ROMs* roms, u8* deviceID, bool di
|
||||||
, roms(roms)
|
, roms(roms)
|
||||||
, deviceID(deviceID)
|
, deviceID(deviceID)
|
||||||
, displayPNGIcons(displayPNGIcons)
|
, displayPNGIcons(displayPNGIcons)
|
||||||
|
, buttonChangedDevice(false)
|
||||||
, screenMain(screenMain)
|
, screenMain(screenMain)
|
||||||
, screenLCD(screenLCD)
|
, screenLCD(screenLCD)
|
||||||
, scrollHighlightRate(scrollHighlightRate)
|
, scrollHighlightRate(scrollHighlightRate)
|
||||||
|
@ -820,6 +821,37 @@ void FileBrowser::UpdateInputFolders()
|
||||||
Keyboard* keyboard = Keyboard::Instance();
|
Keyboard* keyboard = Keyboard::Instance();
|
||||||
InputMappings* inputMappings = InputMappings::Instance();
|
InputMappings* inputMappings = InputMappings::Instance();
|
||||||
|
|
||||||
|
if (IEC_Bus::GetInputButtonHeld(4))
|
||||||
|
{
|
||||||
|
if (inputMappings->BrowseSelect())
|
||||||
|
{
|
||||||
|
DEBUG_LOG("DEv8\r\n");
|
||||||
|
GlobalSetDeviceID(8);
|
||||||
|
ShowDeviceAndROM();
|
||||||
|
buttonChangedDevice = true;
|
||||||
|
}
|
||||||
|
else if (inputMappings->BrowseUp())
|
||||||
|
{
|
||||||
|
DEBUG_LOG("DEv9\r\n");
|
||||||
|
GlobalSetDeviceID(9);
|
||||||
|
ShowDeviceAndROM();
|
||||||
|
buttonChangedDevice = true;
|
||||||
|
}
|
||||||
|
else if (inputMappings->BrowseDown())
|
||||||
|
{
|
||||||
|
GlobalSetDeviceID(10);
|
||||||
|
ShowDeviceAndROM();
|
||||||
|
buttonChangedDevice = true;
|
||||||
|
}
|
||||||
|
else if (inputMappings->BrowseBack())
|
||||||
|
{
|
||||||
|
GlobalSetDeviceID(11);
|
||||||
|
ShowDeviceAndROM();
|
||||||
|
buttonChangedDevice = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (folder.entries.size() > 0)
|
if (folder.entries.size() > 0)
|
||||||
{
|
{
|
||||||
//u32 numberOfEntriesMinus1 = folder.entries.size() - 1;
|
//u32 numberOfEntriesMinus1 = folder.entries.size() - 1;
|
||||||
|
@ -893,6 +925,12 @@ void FileBrowser::UpdateInputFolders()
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
else if (inputMappings->BrowseInsert())
|
else if (inputMappings->BrowseInsert())
|
||||||
|
{
|
||||||
|
if (buttonChangedDevice)
|
||||||
|
{
|
||||||
|
buttonChangedDevice = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
FileBrowser::BrowsableList::Entry* current = folder.current;
|
FileBrowser::BrowsableList::Entry* current = folder.current;
|
||||||
if (current)
|
if (current)
|
||||||
|
@ -900,6 +938,7 @@ void FileBrowser::UpdateInputFolders()
|
||||||
dirty = AddToCaddy(current);
|
dirty = AddToCaddy(current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (inputMappings->BrowseNewD64())
|
else if (inputMappings->BrowseNewD64())
|
||||||
{
|
{
|
||||||
char newFileName[64];
|
char newFileName[64];
|
||||||
|
@ -943,6 +982,7 @@ void FileBrowser::UpdateInputFolders()
|
||||||
if (inputMappings->BrowseBack())
|
if (inputMappings->BrowseBack())
|
||||||
PopFolder();
|
PopFolder();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileBrowser::SelectLST(const char* filenameLST)
|
bool FileBrowser::SelectLST(const char* filenameLST)
|
||||||
|
|
|
@ -230,6 +230,7 @@ private:
|
||||||
ROMs* roms;
|
ROMs* roms;
|
||||||
u8* deviceID;
|
u8* deviceID;
|
||||||
bool displayPNGIcons;
|
bool displayPNGIcons;
|
||||||
|
bool buttonChangedDevice;
|
||||||
|
|
||||||
BrowsableList caddySelections;
|
BrowsableList caddySelections;
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ unsigned InputMappings::directDiskSwapRequest = 0;
|
||||||
|
|
||||||
InputMappings::InputMappings()
|
InputMappings::InputMappings()
|
||||||
: keyboardBrowseLCDScreen(false)
|
: keyboardBrowseLCDScreen(false)
|
||||||
|
, insertButtonPressedPrev(false)
|
||||||
|
, insertButtonPressed(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,8 +49,13 @@ bool InputMappings::CheckButtonsBrowseMode()
|
||||||
SetButtonFlag(DOWN_FLAG);
|
SetButtonFlag(DOWN_FLAG);
|
||||||
else if (IEC_Bus::GetInputButtonPressed(3))
|
else if (IEC_Bus::GetInputButtonPressed(3))
|
||||||
SetButtonFlag(BACK_FLAG);
|
SetButtonFlag(BACK_FLAG);
|
||||||
else if (IEC_Bus::GetInputButtonPressed(4))
|
//else if (IEC_Bus::GetInputButtonPressed(4))
|
||||||
|
// SetButtonFlag(INSERT_FLAG);
|
||||||
|
|
||||||
|
insertButtonPressed = !IEC_Bus::GetInputButtonReleased(4);
|
||||||
|
if (insertButtonPressedPrev && !insertButtonPressed)
|
||||||
SetButtonFlag(INSERT_FLAG);
|
SetButtonFlag(INSERT_FLAG);
|
||||||
|
insertButtonPressedPrev = insertButtonPressed;
|
||||||
|
|
||||||
return buttonFlags != 0;
|
return buttonFlags != 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,9 @@ protected:
|
||||||
|
|
||||||
bool keyboardBrowseLCDScreen;
|
bool keyboardBrowseLCDScreen;
|
||||||
|
|
||||||
|
bool insertButtonPressedPrev;
|
||||||
|
bool insertButtonPressed;
|
||||||
|
|
||||||
//inline void SetUartFlag(unsigned flag) { uartFlags |= flag; }
|
//inline void SetUartFlag(unsigned flag) { uartFlags |= flag; }
|
||||||
//inline bool UartFlag(unsigned flag) { return (uartFlags & flag) != 0; }
|
//inline bool UartFlag(unsigned flag) { return (uartFlags & flag) != 0; }
|
||||||
inline void SetKeyboardFlag(unsigned flag) { keyboardFlags |= flag; }
|
inline void SetKeyboardFlag(unsigned flag) { keyboardFlags |= flag; }
|
||||||
|
|
|
@ -27,12 +27,14 @@ extern "C"
|
||||||
|
|
||||||
unsigned char frame[SSD1306_128x64_BYTES];
|
unsigned char frame[SSD1306_128x64_BYTES];
|
||||||
|
|
||||||
SSD1306::SSD1306(int BSCMaster, u8 address, int flip, int type)
|
SSD1306::SSD1306(int BSCMaster, u8 address, unsigned width, unsigned height, int flip, LCD_MODEL type)
|
||||||
: BSCMaster(BSCMaster)
|
: BSCMaster(BSCMaster)
|
||||||
, address(address)
|
, address(address)
|
||||||
, type(type)
|
, type(type)
|
||||||
, flip(flip)
|
, flip(flip)
|
||||||
, contrast(127)
|
, contrast(127)
|
||||||
|
, width(width)
|
||||||
|
, height(height)
|
||||||
{
|
{
|
||||||
RPI_I2CInit(BSCMaster, 1);
|
RPI_I2CInit(BSCMaster, 1);
|
||||||
|
|
||||||
|
@ -45,7 +47,7 @@ void SSD1306::InitHardware()
|
||||||
SendCommand(SSD1306_CMD_DISPLAY_OFF); // 0xAE
|
SendCommand(SSD1306_CMD_DISPLAY_OFF); // 0xAE
|
||||||
|
|
||||||
SendCommand(SSD1306_CMD_MULTIPLEX_RATIO); // 0xA8
|
SendCommand(SSD1306_CMD_MULTIPLEX_RATIO); // 0xA8
|
||||||
SendCommand(0x3F); // SSD1306_LCDHEIGHT - 1
|
SendCommand(height-1); // SSD1306_LCDHEIGHT - 1
|
||||||
|
|
||||||
SendCommand(SSD1306_CMD_SET_DISPLAY_OFFSET); // 0xD3 Vertical scroll position
|
SendCommand(SSD1306_CMD_SET_DISPLAY_OFFSET); // 0xD3 Vertical scroll position
|
||||||
SendCommand(0x00); // no Offset
|
SendCommand(0x00); // no Offset
|
||||||
|
@ -61,6 +63,9 @@ void SSD1306::InitHardware()
|
||||||
}
|
}
|
||||||
|
|
||||||
SendCommand(SSD1306_CMD_SET_COM_PINS); // 0xDA Layout and direction
|
SendCommand(SSD1306_CMD_SET_COM_PINS); // 0xDA Layout and direction
|
||||||
|
if (type == LCD_1306_128x32)
|
||||||
|
SendCommand(0x02);
|
||||||
|
else
|
||||||
SendCommand(0x12);
|
SendCommand(0x12);
|
||||||
|
|
||||||
SetContrast(GetContrast());
|
SetContrast(GetContrast());
|
||||||
|
@ -86,7 +91,7 @@ void SSD1306::InitHardware()
|
||||||
|
|
||||||
Home();
|
Home();
|
||||||
|
|
||||||
if (type != 1106)
|
if (type != LCD_1106_128x64)
|
||||||
SendCommand(SSD1306_CMD_DEACTIVATE_SCROLL); // 0x2E
|
SendCommand(SSD1306_CMD_DEACTIVATE_SCROLL); // 0x2E
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,23 +120,23 @@ void SSD1306::Home()
|
||||||
MoveCursorByte(0, 0);
|
MoveCursorByte(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSD1306::MoveCursorByte(u8 row, u8 col)
|
void SSD1306::MoveCursorByte(u8 page, u8 col)
|
||||||
{
|
{
|
||||||
if (col > 127) { col = 127; }
|
if (col > width-1) { col = width-1; }
|
||||||
if (row > 7) { row = 7; }
|
if (page > height/8-1) { page = height/8-1; }
|
||||||
|
|
||||||
if (type == 1106)
|
if (type == LCD_1106_128x64)
|
||||||
col += 2; // sh1106 uses columns 2..129
|
col += 2; // sh1106 uses columns 2..129
|
||||||
|
|
||||||
SendCommand(SSD1306_CMD_SET_PAGE | row); // 0xB0 page address
|
SendCommand(SSD1306_CMD_SET_PAGE | page); // 0xB0 page address
|
||||||
SendCommand(SSD1306_CMD_SET_COLUMN_LOW | (col & 0xf)); // 0x00 column address lower bits
|
SendCommand(SSD1306_CMD_SET_COLUMN_LOW | (col & 0xf)); // 0x00 column address lower bits
|
||||||
SendCommand(SSD1306_CMD_SET_COLUMN_HIGH | (col >> 4)); // 0x10 column address upper bits
|
SendCommand(SSD1306_CMD_SET_COLUMN_HIGH | (col >> 4)); // 0x10 column address upper bits
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSD1306::RefreshScreen()
|
void SSD1306::RefreshScreen()
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < height/8; i++)
|
||||||
{
|
{
|
||||||
RefreshPage(i);
|
RefreshPage(i);
|
||||||
}
|
}
|
||||||
|
@ -151,9 +156,19 @@ void SSD1306::RefreshRows(u32 start, u32 amountOfRows)
|
||||||
|
|
||||||
void SSD1306::RefreshPage(u32 page)
|
void SSD1306::RefreshPage(u32 page)
|
||||||
{
|
{
|
||||||
|
if (page >= height/8)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// x32 displays use lower half (pages 2 and 3)
|
||||||
|
if (type == LCD_1306_128x32)
|
||||||
|
{
|
||||||
|
page = page+4; // 0,1,2,3 -> 4,5,6,7
|
||||||
|
page = page%4; // and wrap it so 4,5 -> 0,1
|
||||||
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
int start = page*128;
|
int start = page*width;
|
||||||
int end = page*128 + 128;
|
int end = start + width;
|
||||||
|
|
||||||
MoveCursorByte(page, 0);
|
MoveCursorByte(page, 0);
|
||||||
for (i = start; i < end; i++)
|
for (i = start; i < end; i++)
|
||||||
|
@ -183,7 +198,7 @@ void SSD1306::SetContrast(u8 value)
|
||||||
contrast = value;
|
contrast = value;
|
||||||
SendCommand(SSD1306_CMD_SET_CONTRAST_CONTROL);
|
SendCommand(SSD1306_CMD_SET_CONTRAST_CONTROL);
|
||||||
SendCommand(value);
|
SendCommand(value);
|
||||||
if (type == 1306)
|
if (type != LCD_1106_128x64) // dont fiddle vcomdeselect on 1106 displays
|
||||||
SetVCOMDeselect( value >> 8);
|
SetVCOMDeselect( value >> 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,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, int flip = 0, int type=1306);
|
SSD1306(int BSCMaster = 1, u8 address = 0x3C, unsigned width = 128, unsigned height = 64, int flip = 0, LCD_MODEL type=LCD_UNKNOWN);
|
||||||
|
|
||||||
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);
|
||||||
|
@ -110,6 +110,8 @@ protected:
|
||||||
int type;
|
int type;
|
||||||
int flip;
|
int flip;
|
||||||
int contrast;
|
int contrast;
|
||||||
|
unsigned width;
|
||||||
|
unsigned height;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -23,14 +23,14 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "ssd_logo.h"
|
#include "ssd_logo.h"
|
||||||
|
|
||||||
void ScreenLCD::Open(u32 widthDesired, u32 heightDesired, u32 colourDepth, int BSCMaster, int LCDAddress, int LCDFlip, int LCDType)
|
void ScreenLCD::Open(u32 widthDesired, u32 heightDesired, u32 colourDepth, int BSCMaster, int LCDAddress, int LCDFlip, LCD_MODEL LCDType)
|
||||||
{
|
{
|
||||||
bpp = 1;
|
bpp = 1;
|
||||||
|
|
||||||
if (widthDesired < 128)
|
if (widthDesired < 128)
|
||||||
widthDesired = 128;
|
widthDesired = 128;
|
||||||
if (heightDesired < 64)
|
if (heightDesired < 32)
|
||||||
heightDesired = 64;
|
heightDesired = 32;
|
||||||
if (widthDesired > 128)
|
if (widthDesired > 128)
|
||||||
widthDesired = 128;
|
widthDesired = 128;
|
||||||
if (heightDesired > 64)
|
if (heightDesired > 64)
|
||||||
|
@ -39,7 +39,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, LCDFlip, LCDType);
|
ssd1306 = new SSD1306(BSCMaster, LCDAddress, width, height, LCDFlip, LCDType);
|
||||||
ssd1306->ClearScreen();
|
ssd1306->ClearScreen();
|
||||||
ssd1306->RefreshScreen();
|
ssd1306->RefreshScreen();
|
||||||
ssd1306->DisplayOn();
|
ssd1306->DisplayOn();
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "ScreenBase.h"
|
#include "ScreenBase.h"
|
||||||
#include "SSD1306.h"
|
#include "SSD1306.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
class ScreenLCD : public ScreenBase
|
class ScreenLCD : public ScreenBase
|
||||||
{
|
{
|
||||||
|
@ -32,7 +33,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Open(u32 width, u32 height, u32 colourDepth, int BSCMaster, int LCDAddress, int LCDFlip, int LCDType);
|
void Open(u32 width, u32 height, u32 colourDepth, int BSCMaster, int LCDAddress, int LCDFlip, LCD_MODEL LCDType);
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -582,9 +582,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetInputButtonPressed(int buttonIndex) { return InputButton[buttonIndex] && !InputButtonPrev[buttonIndex]; }
|
static bool GetInputButtonPressed(int buttonIndex) { return InputButton[buttonIndex] && !InputButtonPrev[buttonIndex]; }
|
||||||
static bool GetInputButtonReleased(int buttonIndex) { return !InputButton[buttonIndex] && InputButtonPrev[buttonIndex]; }
|
static bool GetInputButtonReleased(int buttonIndex) { return InputButton[buttonIndex] == false; }
|
||||||
static bool GetInputButton(int buttonIndex) { return InputButton[buttonIndex]; }
|
static bool GetInputButton(int buttonIndex) { return InputButton[buttonIndex]; }
|
||||||
static bool GetInputButtonRepeating(int buttonIndex) { return inputRepeat[buttonIndex] != inputRepeatPrev[buttonIndex]; }
|
static bool GetInputButtonRepeating(int buttonIndex) { return inputRepeat[buttonIndex] != inputRepeatPrev[buttonIndex]; }
|
||||||
|
static bool GetInputButtonHeld(int buttonIndex) { return inputRepeatThreshold[buttonIndex] >= INPUT_BUTTON_DEBOUNCE_THRESHOLD + (INPUT_BUTTON_REPEAT_THRESHOLD * 2); }
|
||||||
|
|
||||||
static bool OutputLED;
|
static bool OutputLED;
|
||||||
static bool OutputSound;
|
static bool OutputSound;
|
||||||
|
|
24
src/main.cpp
24
src/main.cpp
|
@ -46,7 +46,7 @@ extern "C"
|
||||||
#include "ssd_logo.h"
|
#include "ssd_logo.h"
|
||||||
|
|
||||||
unsigned versionMajor = 1;
|
unsigned versionMajor = 1;
|
||||||
unsigned versionMinor = 8;
|
unsigned versionMinor = 9;
|
||||||
|
|
||||||
// When the emulated CPU starts we execute the first million odd cycles in non-real-time (ie as fast as possible so the emulated 1541 becomes responsive to CBM-Browser asap)
|
// When the emulated CPU starts we execute the first million odd cycles in non-real-time (ie as fast as possible so the emulated 1541 becomes responsive to CBM-Browser asap)
|
||||||
// During these cycles the CPU is executing the ROM self test routines (these do not need to be cycle accurate)
|
// During these cycles the CPU is executing the ROM self test routines (these do not need to be cycle accurate)
|
||||||
|
@ -365,26 +365,30 @@ void InitialiseLCD()
|
||||||
int i2cLcdOnContrast = options.I2CLcdOnContrast();
|
int i2cLcdOnContrast = options.I2CLcdOnContrast();
|
||||||
int i2cLcdDimContrast = options.I2CLcdDimContrast();
|
int i2cLcdDimContrast = options.I2CLcdDimContrast();
|
||||||
int i2cLcdDimTime = options.I2CLcdDimTime();
|
int i2cLcdDimTime = options.I2CLcdDimTime();
|
||||||
int i2cLcdModel = options.I2CLcdModel();
|
LCD_MODEL i2cLcdModel = options.I2CLcdModel();
|
||||||
|
|
||||||
if (i2cLcdModel)
|
if (i2cLcdModel)
|
||||||
{
|
{
|
||||||
|
int width = 128;
|
||||||
|
int height = 64;
|
||||||
|
if (i2cLcdModel == LCD_1306_128x32)
|
||||||
|
height = 32;
|
||||||
screenLCD = new ScreenLCD();
|
screenLCD = new ScreenLCD();
|
||||||
screenLCD->Open(128, 64, 1, i2cBusMaster, i2cLcdAddress, i2cLcdFlip, i2cLcdModel);
|
screenLCD->Open(width, height, 1, i2cBusMaster, i2cLcdAddress, i2cLcdFlip, i2cLcdModel);
|
||||||
screenLCD->SetContrast(i2cLcdOnContrast);
|
screenLCD->SetContrast(i2cLcdOnContrast);
|
||||||
screenLCD->ClearInit(0); // sh1106 needs this
|
screenLCD->ClearInit(0); // sh1106 needs this
|
||||||
|
|
||||||
bool logo_done = false;
|
bool logo_done = false;
|
||||||
if (strcasecmp(options.GetLcdLogoName(), "1541ii") == 0)
|
if ( (height == 64) && (strcasecmp(options.GetLcdLogoName(), "1541ii") == 0) )
|
||||||
{
|
{
|
||||||
screenLCD->PlotRawImage(logo_ssd_1541ii, 0, 0, 128, 64);
|
screenLCD->PlotRawImage(logo_ssd_1541ii, 0, 0, width, height);
|
||||||
snprintf(tempBuffer, tempBufferSize, "Pi1541 V%d.%02d", versionMajor, versionMinor);
|
snprintf(tempBuffer, tempBufferSize, "Pi1541 V%d.%02d", versionMajor, versionMinor);
|
||||||
screenLCD->PrintText(0, 16, 0, tempBuffer, 0xffffffff);
|
screenLCD->PrintText(0, 16, 0, tempBuffer, 0xffffffff);
|
||||||
logo_done = true;
|
logo_done = true;
|
||||||
}
|
}
|
||||||
else if (strcasecmp(options.GetLcdLogoName(), "1541classic") == 0)
|
else if (( height == 64) && (strcasecmp(options.GetLcdLogoName(), "1541classic") == 0) )
|
||||||
{
|
{
|
||||||
screenLCD->PlotRawImage(logo_ssd_1541classic, 0, 0, 128, 64);
|
screenLCD->PlotRawImage(logo_ssd_1541classic, 0, 0, width, height);
|
||||||
logo_done = true;
|
logo_done = true;
|
||||||
}
|
}
|
||||||
else if (f_stat(options.GetLcdLogoName(), &filLcdIcon) == FR_OK && filLcdIcon.fsize <= LCD_LOGO_MAX_SIZE)
|
else if (f_stat(options.GetLcdLogoName(), &filLcdIcon) == FR_OK && filLcdIcon.fsize <= LCD_LOGO_MAX_SIZE)
|
||||||
|
@ -398,7 +402,7 @@ void InitialiseLCD()
|
||||||
u32 bytesRead;
|
u32 bytesRead;
|
||||||
f_read(&fp, LcdLogoFile, LCD_LOGO_MAX_SIZE, &bytesRead);
|
f_read(&fp, LcdLogoFile, LCD_LOGO_MAX_SIZE, &bytesRead);
|
||||||
f_close(&fp);
|
f_close(&fp);
|
||||||
screenLCD->PlotRawImage(LcdLogoFile, 0, 0, 128, 64);
|
screenLCD->PlotRawImage(LcdLogoFile, 0, 0, width, height);
|
||||||
logo_done = true;
|
logo_done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -406,8 +410,8 @@ void InitialiseLCD()
|
||||||
if (!logo_done)
|
if (!logo_done)
|
||||||
{
|
{
|
||||||
snprintf(tempBuffer, tempBufferSize, "Pi1541 V%d.%02d", versionMajor, versionMinor);
|
snprintf(tempBuffer, tempBufferSize, "Pi1541 V%d.%02d", versionMajor, versionMinor);
|
||||||
int x = (128 - 8*strlen(tempBuffer) ) /2;
|
int x = (width - 8*strlen(tempBuffer) ) /2;
|
||||||
int y = (64-16)/2;
|
int y = (height-16)/2;
|
||||||
screenLCD->PrintText(0, x, y, tempBuffer, 0x0);
|
screenLCD->PrintText(0, x, y, tempBuffer, 0x0);
|
||||||
}
|
}
|
||||||
screenLCD->RefreshScreen();
|
screenLCD->RefreshScreen();
|
||||||
|
|
|
@ -145,7 +145,7 @@ Options::Options(void)
|
||||||
, i2cScan(0)
|
, i2cScan(0)
|
||||||
, i2cLcdFlip(0)
|
, i2cLcdFlip(0)
|
||||||
, i2cLcdOnContrast(127)
|
, i2cLcdOnContrast(127)
|
||||||
, i2cLcdModel(0)
|
, i2cLcdModel(LCD_UNKNOWN)
|
||||||
, scrollHighlightRate(0.125f)
|
, scrollHighlightRate(0.125f)
|
||||||
, keyboardBrowseLCDScreen(0)
|
, keyboardBrowseLCDScreen(0)
|
||||||
{
|
{
|
||||||
|
@ -241,9 +241,11 @@ void Options::Process(char* buffer)
|
||||||
{
|
{
|
||||||
strncpy(LCDName, pValue, 255);
|
strncpy(LCDName, pValue, 255);
|
||||||
if (strcasecmp(pValue, "ssd1306_128x64") == 0)
|
if (strcasecmp(pValue, "ssd1306_128x64") == 0)
|
||||||
i2cLcdModel = 1306;
|
i2cLcdModel = LCD_1306_128x64;
|
||||||
|
else if (strcasecmp(pValue, "ssd1306_128x32") == 0)
|
||||||
|
i2cLcdModel = LCD_1306_128x32;
|
||||||
else if (strcasecmp(pValue, "sh1106_128x64") == 0)
|
else if (strcasecmp(pValue, "sh1106_128x64") == 0)
|
||||||
i2cLcdModel = 1106;
|
i2cLcdModel = LCD_1106_128x64;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if ((strcasecmp(pOption, "ROM") == 0) || (strcasecmp(pOption, "ROM1") == 0))
|
else if ((strcasecmp(pOption, "ROM") == 0) || (strcasecmp(pOption, "ROM1") == 0))
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#ifndef OPTIONS_H
|
#ifndef OPTIONS_H
|
||||||
#define OPTIONS_H
|
#define OPTIONS_H
|
||||||
|
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
class TextParser
|
class TextParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -77,7 +79,7 @@ public:
|
||||||
inline unsigned int I2CLcdOnContrast() const { return i2cLcdOnContrast; }
|
inline unsigned int I2CLcdOnContrast() const { return i2cLcdOnContrast; }
|
||||||
inline unsigned int I2CLcdDimContrast() const { return i2cLcdDimContrast; }
|
inline unsigned int I2CLcdDimContrast() const { return i2cLcdDimContrast; }
|
||||||
inline unsigned int I2CLcdDimTime() const { return i2cLcdDimTime; }
|
inline unsigned int I2CLcdDimTime() const { return i2cLcdDimTime; }
|
||||||
inline unsigned int I2CLcdModel() const { return i2cLcdModel; }
|
inline LCD_MODEL I2CLcdModel() const { return i2cLcdModel; }
|
||||||
|
|
||||||
inline const char* GetLcdLogoName() const { return LcdLogoName; }
|
inline const char* GetLcdLogoName() const { return LcdLogoName; }
|
||||||
|
|
||||||
|
@ -123,7 +125,8 @@ private:
|
||||||
unsigned int i2cLcdOnContrast;
|
unsigned int i2cLcdOnContrast;
|
||||||
unsigned int i2cLcdDimContrast;
|
unsigned int i2cLcdDimContrast;
|
||||||
unsigned int i2cLcdDimTime;
|
unsigned int i2cLcdDimTime;
|
||||||
unsigned int i2cLcdModel;
|
// unsigned int i2cLcdModel;
|
||||||
|
LCD_MODEL i2cLcdModel = LCD_UNKNOWN;
|
||||||
|
|
||||||
float scrollHighlightRate;
|
float scrollHighlightRate;
|
||||||
|
|
||||||
|
|
|
@ -892,12 +892,14 @@ static int stbi__mad3sizes_valid(int a, int b, int c, int add)
|
||||||
stbi__addsizes_valid(a*b*c, add);
|
stbi__addsizes_valid(a*b*c, add);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef STBI_NO_LINEAR
|
||||||
// returns 1 if "a*b*c*d + add" has no negative terms/factors and doesn't overflow
|
// returns 1 if "a*b*c*d + add" has no negative terms/factors and doesn't overflow
|
||||||
static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add)
|
static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add)
|
||||||
{
|
{
|
||||||
return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) &&
|
return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) &&
|
||||||
stbi__mul2sizes_valid(a*b*c, d) && stbi__addsizes_valid(a*b*c*d, add);
|
stbi__mul2sizes_valid(a*b*c, d) && stbi__addsizes_valid(a*b*c*d, add);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// mallocs with size overflow checking
|
// mallocs with size overflow checking
|
||||||
static void *stbi__malloc_mad2(int a, int b, int add)
|
static void *stbi__malloc_mad2(int a, int b, int add)
|
||||||
|
@ -912,11 +914,13 @@ static void *stbi__malloc_mad3(int a, int b, int c, int add)
|
||||||
return stbi__malloc(a*b*c + add);
|
return stbi__malloc(a*b*c + add);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef STBI_NO_LINEAR
|
||||||
static void *stbi__malloc_mad4(int a, int b, int c, int d, int add)
|
static void *stbi__malloc_mad4(int a, int b, int c, int d, int add)
|
||||||
{
|
{
|
||||||
if (!stbi__mad4sizes_valid(a, b, c, d, add)) return NULL;
|
if (!stbi__mad4sizes_valid(a, b, c, d, add)) return NULL;
|
||||||
return stbi__malloc(a*b*c*d + add);
|
return stbi__malloc(a*b*c*d + add);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// stbi__err - error
|
// stbi__err - error
|
||||||
// stbi__errpf - error returning pointer to float
|
// stbi__errpf - error returning pointer to float
|
||||||
|
|
|
@ -9,5 +9,11 @@ typedef unsigned long long u64;
|
||||||
|
|
||||||
typedef signed long long s64;
|
typedef signed long long s64;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
LCD_UNKNOWN,
|
||||||
|
LCD_1306_128x64,
|
||||||
|
LCD_1306_128x32,
|
||||||
|
LCD_1106_128x64,
|
||||||
|
} LCD_MODEL;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue