📄 lcd13xx.c
字号:
/*********************************************************************************************************** uC/GUI* Universal graphic software for embedded applications** (c) Copyright 2002, Micrium Inc., Weston, FL* (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH** 礐/GUI is protected by international copyright laws. Knowledge of the* source code may not be used to write a similar product. This file may* only be used in accordance with a license and should not be redistributed* in any way. We appreciate your understanding and fairness.*----------------------------------------------------------------------File : LCD13XX.CPurpose : Driver for LCDs using a single Seiko Epson SED13XX controllers This version supports a single LCD controller in (almost) any hardware configuration. The following derivatives are currently supported: SED1352 SED1354 SED1356 (With/Without BitBlt engine support) SED1374 SED1375 SED13806 Other Epson LCD controllers are very similar and could be covered by this driver as well, but have not been tested.---------------------------------------------------------------------- Version-Date---Author-Explanation ---------------------------------------------------------------------- 3.00s 020724 JE a) LCD_L0_Init changed3.00r 020708 JE a) Changed to work with 2bpp DDP bitmaps3.00q 020705 JE a) Changed to work with 4bpp DDP bitmaps3.00p 020705 JE a) Optimizations changed: LCD_L0_DrawVLine3.00o 020703 JE a) Optimizations changed: LCD_L0_DrawVLine3.00n 020624 JE a) Optimizations added for 4bpp, 16bit bus, LCD_SWAPXY: LCD_L0_DrawVLine, DrawBitLine1BPP_Swap, DrawBitLine4BPP_Swap3.00m 020506 JE a) LCD_FillRectBB changed to work with large rectangles (width > 1024, heigth > 1024)3.00l 020327 JE a) DrawBitLine1BPP for 16bit bus, 4bpp: Compiler problem solved3.00k 020319 JE a) DrawBitLine1BPP for 16bit bus, 4bpp optimized3.00j 020222 JE a) Optimized version DrawBitLine16BPP added b) Macro mapping LCD_SWAP_BYTE_ORDER changed3.00i 020222 JE a) DrawBitLine1BPP_Swap, 16bit bus, 4bpp changed b) LCD_L0_DrawVLine, 16bit bus, 4bpp changed3.00h 020221 JE a) LCD_USE_32BIT_PNT added to support 32Bit offsets b) XY2OFF changed to work with 32Bit offsets c) BITBLT_SET_DESTINATION changed to work with 32Bit offsets3.00g 020221 JE a) LCD_MSB_SHIFT & LCD_LSB_SHIFT removed3.00f 020221 JE a) Remaining LCD_READ_MEM removed b) WRITE_MEM changed for swapped mode3.00e 020218 JE a) Use of READ_MEM, WRITE_MEM instead of LCD_READ_MEM, LCD_WRITE_MEM3.00d9 020129 JE a) DrawBitLine4BPP: Non optimized version used if defined LCD_LUT_SEG b) LCD_L0_DrawVLine, LCD_L0_FillRect: BitBLT-versions not used if defined LCD_LUT_SEG or LCD_LUT_COM c) LCD_DrawBitmap1BPPBB: Not called if defined LCD_LUT_SEG or LCD_LUT_COM d) BitBLT support not used if defined LCD_LUT_SEG or LCD_LUT_COM3.00d8 020129 JE a) Bugfix: LCD_LUT_COM with 'space' now works3.00d7 020124 JE a) DrawBitLine1BPP, 16bit bus, 1bpp optimized3.00df 020123 JE a) LCD_L0_DrawHLine, 16bit bus, 1bpp, LCD_SWAP_BYTE_ORDER added3.00de 020123 JE a) LCD_L0_DrawHLine, 16bit bus, 1bpp optimized3.00d4 020104 JE a) DrawBitLine8BPP, 16Bit bus, 4bpp optimized3.00d3 011204 JE a) BitBLT support changed3.00d2 011129 RS a) 4bpp opt. enabled also with LCD_LUT_COM3.00d1 011115 JE a) Some casts inserted to avoid warnings3.00d 011109 JE a) BitBLT support changed3.00c9 011107 JE a) LCD_L0_DrawHLine 16bpp, 16bit changed b) BPP mapping 15->16bpp removed to keep sure LCD_NUMCOLORS works right3.00c8 011016 JE a) Optimized DrawBitLine4BPP for 16 bit bus, 4 bpp mode now supports LCD_SWAP_BYTE_ORDER3.00c7 011016 RS a) DrawBitLine4BPP for 16 bit bus, 4 bpp mode changed3.00c6 011016 JE a) Optimized version DrawBitLine4BPP for 16 bit bus, 4 bpp mode added3.00c5 010926 JE a) Dummy read from BITBLT memory area inserted to shutdown BITBLT-engine after operation is finished3.00c4 010925 JE a) #define SETNEXTPIXEL(c) SETNEXTPIXEL(c) deleted b) LCD_L0_DrawVLine for 8bit BYW mode changed c) GetPixelIndex changed3.00c3 010925 JE a) Bugfixes: 8bit bus, LCD_MIRROR_Y, LCD_L0_Init3.00c2 010925 JE a) Bugfixes: 16bit bus, LCD_MIRROR_Y3.00c1 010914 RS a) LCDInt.h always included3.00c 010905 RS a) DrawBitLine16BPP taken out via preprocessor for non 16 bpp modes3.00b3 010824 JE a) DrawBitLine16BPP ok3.00b2 010824 JE a) DrawBitLine16BPP (no opt) added, not tested3.00b1 010820 JE a) Bugfixes for LCD_MIRROR_Y, 16 bit bus, 4 bpp3.00b 010820 RS a) Changes for 16bpp mode and non-EPSON controllers3.00a4 010723 JE a) Optimization added for LCD_L0_DrawVLine for 16 bit bus, 4 bpp, SWAP_XY, MIRROR_Y3.00a3 010718 JE a) Bugfix in LCD_L0_GetPixelIndex, LCD_SWAP_XY, LCD_MIRROR_X and LCD_MIRROR_Y was not supported b) Bugfix: DrawBitLine8BPP, DrawBitLine4BPP: LCD_SWAP_XY was not supported3.00a2 010718 JE a) Bugfix in LCD_L0_GetPixelIndex, optimized version for LCD_BUSWIDTH == 83.00a1 010515 RS a) SUperfluos compiler warnings eliminated3.00a 010509 RS a) LUT init for 1374 fixed3.00 010430 RS a) Optimizaion for 4bpp bitmaps in regular 8bpp mode2.02 010402 RS a) LCD_GetDevCaps removed from driver (now LCD.c)2.00f 001030 RS a) Optimization for 8bpp bitmaps without palette in 16bit bus mode now also used if COM LUT is being used -> mayor acceleration if this configuration is used (VDO/BMW)2.00e 001019 RS a) Optimization for 8bpp bitmaps without palette in 16bit bus mode now also used if COM LUT is being used -> mayor acceleration if this configuration is used (VDO/BMW)2.00d 001017 RS a) Video memory init removed from this driver (normally done by LCD_Init in LCD.c)2.00c 001013 RS a) 8bbp dd-bitmaps in 16bit bus, 4bpp configuration accelerated (for use with memory devices)2.00b 000925 RS a) Source cleaned up (no effect on code)2.00a 000911 RS a) LCD_DATAADR introduced2.00 000525 RS a) New interface supported. b) Support for LCD_LUT_COM added1.40a 000524 RS/JE a) 1 BPP bitmap draw fix: Misbehaved if Backgroundcolor == Color1.40 000516 RS a) LCD_GetColorIndex implemented b) Support for simulation added1.30l 000505 RS/JE a) 8 bit DDB fix1.30k 000428 JE a) Optimized version of DrawBitLine8BPP (16 bit) now draws transparent bitmaps1.30j 000426 RS a) Support for V1.30 interface 1) LCD_SetColorIndex, LCD_SetBkColorIndex added 2) LCD_InitLUT,LCD_SetColor, LCD_SetBkColor removed (now in LCD_COLOR) b) Cleanup1.30i 000416 RS a) Small cleanups1.30h 000411 RS a) Optimized DrawHLine 8bpp, 8 bit bus1.30g 000411 JE a) Now all textmodes supported in DrawBitLine1BPP for 1bpp mode1.30f 000411 JE a) Support for 1bpp mode added to LCD_L0_GetPixelIndex b) Clipping in DrawBitLine1BPP for 1bpp mode changed1.30e 000408 RS a) 1BPP mode, 8bit bus accelerated1.30d 000408 RS a) LCD_SetNormalDispMode, LCD_SetReverseDispMode eliminated1.30c 000406 JE a) Code generation: 133x controller excluded1.30b 000404 RS a) LCD_DrawHLine accelerated for 1BPP/8bitbus 1.30a 000403 RS a) Support for 1bpp mode added with 16 bit bus1.30 000402 RS a) Interface changed: LCD_GetDevCaps1.14j 000401 RS a) Offset type changed to unsigned1.14i 000327 RS a) LCD_SetPaletteEntry renamed LCD_L0_SetLUTEntry LCD_InitPalette renamed LCD_InitLUT1.14h 000324 JE a) DrawBitLine8BPP_DDP & DrawBitLine8BPP merged1.14g 000323 RS a) offets types changed from int to unsigned int in order for 16-bit CPUs to cope with bigger vmem areas b) COLOR2INDEX macro created (simplifying driver source) c) LCD_SetBkColorIndex, LCD_SetColorIndex created1.14f 000322 RS a) 1BPP mde supported1.14e 000321 RS a) 4BPP mode, 8 bit bus accelerated1.14d 000320 RS a) Support for 1375 palette init added1.14c 000306 JE a) Support for SED13806 added1.14b 991213 JE a) LCD_DrawBitMap changed: If LCD_MIRROR_X==1 the standard routine DrawBitLine1BPP has to be used1.14a 991211 RS a) 8-bit mode Swapped, y-mirror accelerated (using SETNEXTPIXEL)1.14 991206 RS a) SWAP_XY modes supported, 8-bit bus modes accelerated1.12b 991201 RS a) XY2OFF macro clean up: parameterorder changed1.12a 991129 RS a) Additional defaults for config switches defined in order to keep config files simple1.12 991128 RS a) PIXELCOLOR definition moved to top in order to avoid compiler warnings b) Optimizations for 8 bit modes added1.10.25 991113 RS a) Comments brushed up b) Cleanup in LCD_DrawBitmap1BPPBB c) LCD_DrawBitLine1BPPBB eliminated, as its functionality has been completely replaced by LCD_DrawBitmap1BPPBB d) Default for LCD_OPTIMIZE set to (1) for all configurations e) LCD_DrawBitmap1BPPBB would not necessarily work correctly if the drawing area had been reduced because of clipping to less than one line. Fixed.1.10.24 991022 JE a) Support for LCD_COMTRANS & LCD_SEGTRANS completed b) LUT init for SED1356 changed, reverse mode supported1.10.23 991021 RS a) Illegal optimization were used with LCD_COMTRANS Fixed.1.10.22 991021 JE a) BitBLT support for SED1356 accellerated, drawing 1 bitmap instead of bitlines b) LCD_TYPE_COMTRANS & LCD_TYPE_SEGTRANS (re)implemented c) LCD_ENABLE_REG_ACCESS implemented to accellerate BitBLT routines with register access1.10.21 991020 JE a) BitBLT support for SED1356 finished and cleand up1.10.20 991019 JE/RS a) LCD_SetPalette (re)implemented for 1354 controllers1.10.19 991019 JE a) SetBkColor/SetColor fix b) LCD_DrawPixelAA added1.10.18 991015 JE a) BitBLT Support added for 8bpp and 15bpp color mode1.10.17 991012 JE a) LCD_DrawBitLine8BPP changed1.10.16 991012 JE a) LCD_DrawHLine changed b) Color translation in 8bpp mode supported1.10.15 991011 RS a) LCD_DrawBitLine8BPP optimized for 16 bit bus, 8bpp b) LCD_DrawHLine optimized for 16 bit bus, 8bpp c) Color translation changed, PhysColors only used when LCD_FIXEDPALETTE == 01.10.14 991011 JE a) Optimizations in LCD_DrawHLine changed in 8 & 15b pp mode1.10.13 991009 RS a) LCD_DrawHLine cleaned up for easier readability b) Support for 8 bit bus added c) XY2OFF macro cleaned up, accelerated d) Palettes reversed for all gray modes as default (since most displays require current (or set bi ts) in order to make a pixel dark e) DrawBitLine2BPP: Bug with transparent bitmaps fixed: The left 1-4 pixel were not drawn or not drawn correctly1.10.12 991008 JE a) LCD_DrawHLine changed b) renamed LCD_USE_OPT -> LCD_OPTIMIZE c) LCD_LSB_SHIFT introduced in order to support both big and little endian systems. d) Result of XY2OFF changed from byte to word1.10.11 991007 JE a) Configuration switch LCD_USE_OPT included b) X-clipping in DrawBitLine1BPP & DrawBitLine2BPP changed c) LCD_DrawVLine changed, the last pixel of a line was not drawn1.10.10 991007 JE a) Support for clipping and XOR modes for 4bpp and 8bpp included b) LCD_DrawVLine optimized c) X-clipping in DrawBitLine8BPP changed1.10.09 991005 JE a) Support 4bpp and 8bpp included b) Optimization for LCD_DrawHLine 8bpp and 4bpp c) New LCD_SHIFT_DATA to shift data bits d) Offset calculation in dependence of LCD_BUSWIDTH included1.10.08 990928 RS a) Optimization for LCD_DrawHLine b) Various compile warnings eliminated c) LCD_Color2Color15 renamed LCD_Color2Index151.10.07 990927 RS a) Defaults for config switches added b) LCD_SWAPXY --> LCD_SWAP_XY for compatibility c) LCD_SetPalette eliminated1.10.06 990924 JE/RS a) BYTESPERLINE changed to work for a normal system (BMW might require Config change)1.10.05 990831 RS a) Full support for transparent 16 color bitmaps (bugfix)1.10.04 Font support for true color1.10.031.10.02 990713 RS LCD_MEMSIZE calculation changed1.10.01 990713 RS Fix for Memsize in colormode1.10 990711 RS Support for Segment/Com Lookup tables added1.00 990118 RS First release. ---------------------------LIST OF CONFIG SWITCHES--------------------The following is a list of additional configuration switches for thisdriver. These switches might not be listed in the manual, becausethe manual mainly covers the general config switches which aresupported by all drivers.----------------------------------------------------------------------define ----------------------Explanation------------------------------LCD_SWAP_BYTE_ORDER Activate if high low bytes are swapped Default: 0LCD_WRITE_MEM32(Off,Data32) This macro accelerates display access if defined by allowing the CPU to write 32 bits at a time to the controller. (For 32 bits CPUs only and only if the BUS interface unit can automatically convert this to 2 16 bit accessesLCD_OPTIMIZE Controls the use of optimized routines. If 1, several (speed) optimizations are used. Default: ON (1)LCD_USE_BITBLT This switch controls the use of optimized routines with SED1356 bitblt engine. If 1, the optimized routines with bitblt access are used. The default value depends of LCD_BITSPERPIXEL: (4 ) -> 0, (8,15) -> 1LCD_ENABLE_REG_ACCESS() LCD_ENABLE_MEM_ACCESS() In most systems (and with most LCD-controllers) registers / memory can be accessed at different addresses. However, in some systems, it could be necessary to exec code in order to be able to access the registers or memory. This code should then be placed in these macros (rather than the actual access macros, which would be slowed down)LCD_DATAADR define adress if video memory can be treated like regular memory (will speed up driver)----------------------------------------------------------------------Known problems or limitations with current version----------------------------------------------------------------------none----------------------------------------------------------------------Open issues----------------------------------------------------------------------None---------------------------END-OF-HEADER------------------------------*/#include <stddef.h> /* needed for definition of NULL */#include "LCD_Private.H" /* private modul definitions & config */#include "GUI_Private.H"#include "GUIDebug.h"#include "LCD_0.h" /* Defines for first display */#if (LCD_CONTROLLER/100 == 13) && (LCD_CONTROLLER/10 != 133) \ && (!defined(WIN32) | defined(LCD_SIMCONTROLLER))/* ********************************************************* * * * Compiler specific settings * * * **********************************************************/#ifdef WIN32 /* Avoid warnings in MS-compiler */ #pragma warning(disable : 4244) // warning C4244: '=' : conversion from 'long ' to 'unsigned char ', possible loss of data #pragma warning(disable : 4761) // warning C4761: integral size mismatch in argument; conversion supplied#endif/************************************************************ Controller renumbering********************************************************** EPSON decided to rename all of their controllers. In order to be able to work with old and new numbers, we simply map the old ones to the new ones.*/#if LCD_CONTROLLER == 1386 #undef LCD_CONTROLLER #define LCD_CONTROLLER 13806#endif/* ********************************************************* * * * Defaults for configuration * * * **********************************************************//* Switch for support of multiple pages. Only available with certain LCD-controllers */#ifndef LCD_SUPPORT_PAGING #define LCD_SUPPORT_PAGING (0)#endif#ifndef LCD_SCHEDULE_CNT #define LCD_SCHEDULE_CNT (0)#endif#ifndef LCD_NUM_CONTROLLERS #define LCD_NUM_CONTROLLERS (1)#endif#ifndef LCD_BUSWIDTH #define LCD_BUSWIDTH (16)#endif#ifndef LCD_OPTIMIZE #define LCD_OPTIMIZE (1)#endif#if (LCD_CONTROLLER == 1356) || (LCD_CONTROLLER == 13806) #ifndef LCD_USE_BITBLT
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -