Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
u8g_dev_t6963_240x64.c
00001 /* 00002 00003 u8g_dev_t6963_240x64.c 00004 00005 Tested with Varitronix MGLS240128TZ 00006 00007 Universal 8bit Graphics Library 00008 00009 Copyright (c) 2013, olikraus@gmail.com 00010 All rights reserved. 00011 00012 Redistribution and use in source and binary forms, with or without modification, 00013 are permitted provided that the following conditions are met: 00014 00015 * Redistributions of source code must retain the above copyright notice, this list 00016 of conditions and the following disclaimer. 00017 00018 * Redistributions in binary form must reproduce the above copyright notice, this 00019 list of conditions and the following disclaimer in the documentation and/or other 00020 materials provided with the distribution. 00021 00022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 00023 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 00024 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00025 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00026 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00027 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00028 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00029 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00032 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00033 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 00034 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00035 00036 00037 Application Notes for the MGLS 240x128 00038 www.baso.no/content/pdf/T6963C_Application.pdf 00039 00040 Hitachi App Notes: 00041 https://www.sparkfun.com/datasheets/LCD/Monochrome/AN-029-Toshiba_T6963C.pdf 00042 00043 Notes: 00044 The font selection pins should generate the 8x8 font. 00045 For the MGLS240128TZ only FS1 is available on pin 18. 00046 FS1 must be low to generate the 8x8 font. 00047 00048 00049 */ 00050 00051 #include "u8g.h" 00052 00053 #define WIDTH 240 00054 #define HEIGHT 64 00055 #define PAGE_HEIGHT 16 00056 00057 00058 /* 00059 http://www.mark-products.com/graphics.htm#240x64%20Pixel%20Format 00060 */ 00061 00062 /* text is not used, so settings are not relevant */ 00063 static const uint8_t u8g_dev_t6963_240x64_init_seq[] PROGMEM = { 00064 U8G_ESC_CS(0), /* disable chip */ 00065 U8G_ESC_ADR(0), /* data mode */ 00066 U8G_ESC_RST(15), /* do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/ 00067 00068 U8G_ESC_CS(1), /* enable chip */ 00069 U8G_ESC_DLY(50), /* delay 50 ms */ 00070 00071 U8G_ESC_ADR(0), /* data mode */ 00072 0x000, /* low byte */ 00073 0x000, /* height byte */ 00074 U8G_ESC_ADR(1), /* instruction mode */ 00075 0x021, /* set cursor position */ 00076 00077 U8G_ESC_ADR(0), /* data mode */ 00078 0x000, /* low byte */ 00079 0x000, /* height byte */ 00080 U8G_ESC_ADR(1), /* instruction mode */ 00081 0x022, /* set offset */ 00082 00083 U8G_ESC_ADR(0), /* data mode */ 00084 0x000, /* low byte */ 00085 0x000, /* height byte */ 00086 U8G_ESC_ADR(1), /* instruction mode */ 00087 0x040, /* text home */ 00088 00089 U8G_ESC_ADR(0), /* data mode */ 00090 WIDTH/8, /* low byte */ 00091 0x000, /* height byte */ 00092 U8G_ESC_ADR(1), /* instruction mode */ 00093 0x041, /* text columns */ 00094 00095 U8G_ESC_ADR(0), /* data mode */ 00096 0x000, /* low byte */ 00097 0x000, /* height byte */ 00098 U8G_ESC_ADR(1), /* instruction mode */ 00099 0x042, /* graphics home */ 00100 00101 U8G_ESC_ADR(0), /* data mode */ 00102 WIDTH/8, /* low byte */ 00103 0x000, /* height byte */ 00104 U8G_ESC_ADR(1), /* instruction mode */ 00105 0x043, /* graphics columns */ 00106 00107 // mode set 00108 // 0x080: Internal CG, OR Mode 00109 // 0x081: Internal CG, EXOR Mode 00110 // 0x083: Internal CG, AND Mode 00111 // 0x088: External CG, OR Mode 00112 // 0x089: External CG, EXOR Mode 00113 // 0x08B: External CG, AND Mode 00114 U8G_ESC_ADR(1), /* instruction mode */ 00115 0x080, /* mode register: OR Mode, Internal Character Mode */ 00116 00117 U8G_ESC_ADR(1), /* instruction mode */ 00118 // display mode 00119 // 0x090: Display off 00120 // 0x094: Graphic off, text on, cursor off, blink off 00121 // 0x096: Graphic off, text on, cursor on, blink off 00122 // 0x097: Graphic off, text on, cursor on, blink on 00123 // 0x098: Graphic on, text off, cursor off, blink off 00124 // 0x09a: Graphic on, text off, cursor on, blink off 00125 // ... 00126 // 0x09c: Graphic on, text on, cursor off, blink off 00127 // 0x09f: Graphic on, text on, cursor on, blink on 00128 0x098, /* mode register: Display Mode, Graphics on, Text off, Cursor off */ 00129 00130 U8G_ESC_ADR(0), /* data mode */ 00131 0x000, /* low byte */ 00132 0x000, /* height byte */ 00133 U8G_ESC_ADR(1), /* instruction mode */ 00134 0x024, /* set adr pointer */ 00135 00136 00137 U8G_ESC_DLY(100), /* delay 100 ms */ 00138 00139 U8G_ESC_ADR(0), /* data mode */ 00140 U8G_ESC_CS(0), /* disable chip */ 00141 U8G_ESC_END /* end of sequence */ 00142 }; 00143 00144 uint8_t u8g_dev_t6963_240x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) 00145 { 00146 switch(msg) 00147 { 00148 case U8G_DEV_MSG_INIT: 00149 u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE); 00150 u8g_WriteEscSeqP(u8g, dev, u8g_dev_t6963_240x64_init_seq); 00151 break; 00152 case U8G_DEV_MSG_STOP: 00153 break; 00154 case U8G_DEV_MSG_PAGE_NEXT: 00155 { 00156 uint8_t y, i; 00157 uint16_t disp_ram_adr; 00158 uint8_t *ptr; 00159 u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); 00160 00161 00162 u8g_SetAddress(u8g, dev, 0); /* data mode */ 00163 u8g_SetChipSelect(u8g, dev, 1); 00164 y = pb->p.page_y0; 00165 ptr = pb->buf; 00166 disp_ram_adr = WIDTH/8; 00167 disp_ram_adr *= y; 00168 for( i = 0; i < PAGE_HEIGHT; i ++ ) 00169 { 00170 u8g_SetAddress(u8g, dev, 0); /* data mode */ 00171 u8g_WriteByte(u8g, dev, disp_ram_adr&255 ); /* address low byte */ 00172 u8g_WriteByte(u8g, dev, disp_ram_adr>>8 ); /* address hight byte */ 00173 u8g_SetAddress(u8g, dev, 1); /* cmd mode */ 00174 u8g_WriteByte(u8g, dev, 0x024 ); /* set adr ptr */ 00175 00176 u8g_WriteSequence(u8g, dev, WIDTH/8, ptr); 00177 00178 ptr += WIDTH/8; 00179 disp_ram_adr += WIDTH/8; 00180 } 00181 u8g_SetAddress(u8g, dev, 0); /* data mode */ 00182 u8g_SetChipSelect(u8g, dev, 0); 00183 } 00184 break; 00185 } 00186 return u8g_dev_pb16h1_base_fn(u8g, dev, msg, arg); 00187 } 00188 00189 // U8G_PB_DEV(u8g_dev_t6963_240x64_8bit, WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_t6963_240x64_fn, U8G_COM_T6963); 00190 00191 uint8_t u8g_dev_t6963_240x64_2x_bw_buf[WIDTH/8*PAGE_HEIGHT] U8G_NOCOMMON ; 00192 u8g_pb_t u8g_dev_t6963_240x64_2x_bw_pb = { {PAGE_HEIGHT, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_t6963_240x64_2x_bw_buf}; 00193 u8g_dev_t u8g_dev_t6963_240x64_8bit = { u8g_dev_t6963_240x64_fn, &u8g_dev_t6963_240x64_2x_bw_pb, U8G_COM_T6963 }; 00194 00195 00196
Generated on Tue Jul 12 2022 17:30:57 by
1.7.2