diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index a80796e31..f02325d9f 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -1237,7 +1237,7 @@ void registerOpenTxFirmwares() /* MEGA2560 board */ openTx = new OpenTxFirmware("opentx-mega2560", QObject::tr("OpenTX for MEGA2560 board"), BOARD_MEGA2560); - Option LCD_options[] = { { "ST7565P LCD", QObject::tr("ST7565P LCD or compatible"), 0 }, { "ST7565R LCD", QObject::tr("ST7565R LCD or compatible"), 0 }, { NULL } }; + Option LCD_options[] = { { "LCD_ST7565P", QObject::tr("ST7565P LCD or compatible"), 0 }, { "LCD_ST7565R", QObject::tr("ST7565R LCD or compatible"), 0 }, { NULL } }; openTx->addOptions(LCD_options); openTx->addOption("heli", QObject::tr("Enable heli menu and cyclic mix support")); openTx->addOption("templates", QObject::tr("Enable TEMPLATES menu")); diff --git a/radio/src/Makefile b/radio/src/Makefile index e28de2bed..05513e418 100644 --- a/radio/src/Makefile +++ b/radio/src/Makefile @@ -672,11 +672,14 @@ ifeq ($(PCB), MEGA2560) BITMAPS += bitmaps/9X/splash.lbm bitmaps/9X/asterisk.lbm bitmaps/9X/about.lbm GUIGENERALSRC += gui/$(GUIDIRECTORY)/menu_general_diagkeys.cpp gui/$(GUIDIRECTORY)/menu_general_diaganas.cpp - ifeq ($(PCBREV), ST7565R) - EXTRABOARDSRC = targets/mega2560/lcd_driver_ST7565R.cpp targets/common_avr/telemetry_driver.cpp - else + # LCD driver + # Values: ST7565R, ERC12864FSF, MULTIPLEX (none = ST7565P) + LCD = ST7565R + + ifeq ($(LCD), ST7565R) + CPPDEFS += -DLCD_ST7565R + endif EXTRABOARDSRC = targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp - endif ifeq ($(SDCARD), YES) EXTRABOARDSRC += $(FATFSDIR)/ff.c $(FATFSDIR)/fattime.c $(FATFSDIR)/option/ccsbcs.c targets/gruvin9x/diskio.cpp diff --git a/radio/src/targets/mega2560/lcd_driver_ST7565R.cpp b/radio/src/targets/mega2560/lcd_driver_ST7565R.cpp deleted file mode 100644 index b0be5999c..000000000 --- a/radio/src/targets/mega2560/lcd_driver_ST7565R.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Authors (alphabetical order) - * - Andre Bernet - * - Andreas Weitl - * - Bertrand Songis - * - Bryan J. Rentoul (Gruvin) - * - Cameron Weeks - * - Erez Raviv - * - Gabriel Birkus - * - Jean-Pierre Parisy - * - Karl Szmutny - * - Michael Blandford - * - Michal Hlavinka - * - Pat Mackenzie - * - Philip Moss - * - Rob Thomson - * - Romolo Manfredini - * - Thomas Husterer - * - * opentx is based on code named - * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, - * er9x by Erez Raviv: http://code.google.com/p/er9x/, - * and the original (and ongoing) project by - * Thomas Husterer, th9x: http://code.google.com/p/th9x/ - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include "opentx.h" - -#define delay_1us() _delay_us(1) -void delay_1_5us(int ms) -{ - for(int i=0; i0; --x) { - PORTA_LCD_DAT = *p++; - PORTC_LCD_CTRL |= (1<SEG1) +#ifdef LCD_ST7565R + 0xE2, //Initialize the internal functions + 0xAE, //DON = 0: display OFF + 0xA0, //ADC = 0: normal direction(SEG132->SEG1) 0xA6, //REV = 0: non-reverse display 0xA4, //EON = 0: normal display. non-entire -#ifdef LCD_ERC12864FSF - 0xA3, // Select LCD bias + 0xA2, //Select LCD bias + 0xC8, //SHL = 1: reverse direction (COM64->COM1) + 0x2F, //Control power circuit operation VC=VR=VF=1 + 0x25, //Select int resistance ratio R2 R1 R0 =5 + 0x81, //Set reference voltage Mode + 0x22, //24 SV5 SV4 SV3 SV2 SV1 SV0 = 0x18 + 0xAF, //DON = 1: display ON + 0x60 //sets the display start line to zero +#elif LCD_ERC12864FSF + 0xE2, //Initialize the internal functions + 0xAE, //DON = 0: display OFF + 0xA1, //ADC = 1: reverse direction(SEG132->SEG1) + 0xA6, //REV = 0: non-reverse display + 0xA4, //EON = 0: normal display. non-entire + 0xA3, //Select LCD bias 0xC0, //SHL = 0: normal direction (COM1->COM64) 0x2F, //Control power circuit operation VC=VR=VF=1 0x27, //Select int resistance ratio R2 R1 R0 0x81, //Set reference voltage Mode - 0x2D, // 24 SV5 SV4 SV3 SV2 SV1 SV0 + 0x2D, //24 SV5 SV4 SV3 SV2 SV1 SV0 + 0xAF //DON = 1: display ON #else - 0xA2, // Select LCD bias=0 + 0xE2, //Initialize the internal functions + 0xAE, //DON = 0: display OFF + 0xA1, //ADC = 1: reverse direction(SEG132->SEG1) + 0xA6, //REV = 0: non-reverse display + 0xA4, //EON = 0: normal display. non-entire + 0xA2, //Select LCD bias=0 0xC0, //SHL = 0: normal direction (COM1->COM64) 0x2F, //Control power circuit operation VC=VR=VF=1 0x25, //Select int resistance ratio R2 R1 R0 =5 0x81, //Set reference voltage Mode - 0x22, // 24 SV5 SV4 SV3 SV2 SV1 SV0 = 0x18 -#endif - + 0x22, //24 SV5 SV4 SV3 SV2 SV1 SV0 = 0x18 0xAF //DON = 1: display ON +#endif }; inline void lcdInit() @@ -106,7 +125,7 @@ inline void lcdInit() delay_2us(); PORTC_LCD_CTRL |= (1<