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_sbn1661_122x32.c
00001 /* 00002 00003 u8g_dev_sbn1661_122x32.c 00004 00005 WG12232 display with 2xSBN1661 / SED1520 controller (122x32 display) 00006 At the moment only available in the Arduino Environment 00007 00008 Universal 8bit Graphics Library 00009 00010 Copyright (c) 2011, olikraus@gmail.com 00011 All rights reserved. 00012 00013 Redistribution and use in source and binary forms, with or without modification, 00014 are permitted provided that the following conditions are met: 00015 00016 * Redistributions of source code must retain the above copyright notice, this list 00017 of conditions and the following disclaimer. 00018 00019 * Redistributions in binary form must reproduce the above copyright notice, this 00020 list of conditions and the following disclaimer in the documentation and/or other 00021 materials provided with the distribution. 00022 00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 00024 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 00025 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00026 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00028 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00029 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00030 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00031 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00033 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00034 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 00035 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 00037 00038 */ 00039 00040 #include "u8g.h" 00041 00042 #define WIDTH 122 00043 #define HEIGHT 32 00044 #define PAGE_HEIGHT 8 00045 00046 00047 static const uint8_t u8g_dev_sbn1661_122x32_init_seq[] PROGMEM = { 00048 U8G_ESC_CS(0), /* disable chip */ 00049 U8G_ESC_ADR(0), /* instruction mode */ 00050 U8G_ESC_RST(15), /* do reset low pulse with (15*16)+2 milliseconds */ 00051 U8G_ESC_CS(1), /* enable chip 1 */ 00052 0x0af, /* display on */ 00053 0x0c0, /* display start at line 0 */ 00054 0x0a0, /* a0: ADC forward, a1: ADC reverse */ 00055 0x0a9, /* a8: 1/16, a9: 1/32 duty */ 00056 U8G_ESC_CS(2), /* enable chip 2 */ 00057 0x0af, /* display on */ 00058 0x0c0, /* display start at line 0 */ 00059 0x0a0, /* a0: ADC forward, a1: ADC reverse */ 00060 0x0a9, /* a8: 1/16, a9: 1/32 duty */ 00061 00062 U8G_ESC_CS(0), /* disable chip */ 00063 00064 00065 U8G_ESC_END /* end of sequence */ 00066 }; 00067 00068 uint8_t u8g_dev_sbn1661_122x32_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) 00069 { 00070 switch(msg) 00071 { 00072 case U8G_DEV_MSG_INIT: 00073 u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_NONE); 00074 u8g_WriteEscSeqP(u8g, dev, u8g_dev_sbn1661_122x32_init_seq); 00075 break; 00076 case U8G_DEV_MSG_STOP: 00077 break; 00078 case U8G_DEV_MSG_PAGE_NEXT: 00079 { 00080 u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); 00081 00082 u8g_SetAddress(u8g, dev, 0); /* command mode */ 00083 u8g_SetChipSelect(u8g, dev, 1); 00084 u8g_WriteByte(u8g, dev, 0x0b8 | pb->p.page); /* select current page (SBN1661/SED1520) */ 00085 u8g_WriteByte(u8g, dev, 0x000 ); /* set X address */ 00086 u8g_SetAddress(u8g, dev, 1); /* data mode */ 00087 u8g_WriteSequence(u8g, dev, WIDTH/2, pb->buf); 00088 00089 u8g_SetAddress(u8g, dev, 0); /* command mode */ 00090 u8g_SetChipSelect(u8g, dev, 2); 00091 u8g_WriteByte(u8g, dev, 0x0b8 | pb->p.page); /* select current page (SBN1661/SED1520) */ 00092 u8g_WriteByte(u8g, dev, 0x000 ); /* set X address */ 00093 u8g_SetAddress(u8g, dev, 1); /* data mode */ 00094 u8g_WriteSequence(u8g, dev, WIDTH/2, WIDTH/2+(uint8_t *)pb->buf); 00095 00096 u8g_SetChipSelect(u8g, dev, 0); 00097 00098 } 00099 break; 00100 case U8G_DEV_MSG_CONTRAST: 00101 break; 00102 } 00103 return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg); 00104 } 00105 00106 /* u8g_com_arduino_sw_spi_fn does not work, too fast??? */ 00107 U8G_PB_DEV(u8g_dev_sbn1661_122x32 , WIDTH, HEIGHT, PAGE_HEIGHT, u8g_dev_sbn1661_122x32_fn, u8g_com_arduino_no_en_parallel_fn); 00108
Generated on Tue Jul 12 2022 17:30:57 by
1.7.2