LCD type is now an enum

This commit is contained in:
penfold42 2018-07-26 11:06:21 +10:00
parent 5fda5024f7
commit 5f8b173155
5 changed files with 19 additions and 8 deletions

View file

@ -23,7 +23,7 @@
#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;

View file

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

View file

@ -365,7 +365,7 @@ 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)
{ {

View file

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

View file

@ -19,6 +19,13 @@
#ifndef OPTIONS_H #ifndef OPTIONS_H
#define OPTIONS_H #define OPTIONS_H
typedef enum {
LCD_UNKNOWN,
LCD_1306_128x64,
LCD_1306_128x32,
LCD_1106_128x64,
} LCD_MODEL;
class TextParser class TextParser
{ {
public: public:
@ -77,7 +84,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 +130,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;