/* * Copyright (C) OpenTX * * Based on code named * th9x - http://code.google.com/p/th9x * er9x - http://code.google.com/p/er9x * gruvin9x - http://code.google.com/p/gruvin9x * * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html * * 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. */ void lcdSendCtl(uint8_t val) { PORTC_LCD_CTRL &= ~(1<SEG1) 0xA6, //REV = 0: non-reverse display 0xA4, //EON = 0: normal display. non-entire 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 //Set the display start line to zero #elif defined(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 0xAF //DON = 1: display ON #else //ST7565P (default 9x LCD) 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 0xAF //DON = 1: display ON #endif }; void lcdInit() { LCD_LOCK(); PORTC_LCD_CTRL &= ~(1<0; --x) { PORTA_LCD_DAT = *p++; PORTC_LCD_CTRL |= (1<