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.
Dependents: receiver TFT_CJS_ssd0139 poster8x8_ranger
Fork of LCDTFT by
LCDTFT.h
00001 /* 00002 @file LCDTFT.h 00003 @version: 1.0 00004 00005 @web www.micros-designs.com.ar 00006 @date 30/01/11 00007 00008 *- Version Log --------------------------------------------------------------* 00009 * Fecha Autor Comentarios * 00010 *----------------------------------------------------------------------------* 00011 * 30/01/11 Suky Original * 00012 *----------------------------------------------------------------------------*/ 00013 /////////////////////////////////////////////////////////////////////////// 00014 //// //// 00015 //// //// 00016 //// (C) Copyright 2011 www.micros-designs.com.ar //// 00017 //// Este c�digo puede ser usado, modificado y distribuido libremente //// 00018 //// sin eliminar esta cabecera y sin garant�a de ning�n tipo. //// 00019 //// //// 00020 //// //// 00021 /////////////////////////////////////////////////////////////////////////// 00022 00023 /** Libreria para LCD TFT chip Himax HX8347-A 00024 * Library for 320x240 tft lcd 00025 * 00026 * 00027 * @code 00028 * #include "mbed.h" 00029 * #include "LCDTFT.h" 00030 * 00031 * 00032 * // pins for TFT - now using 8 bit mode 00033 * BusOut MyBus(PTA13,PTD5,PTD4,PTA12,PTA4,PTA5,PTC8,PTC9); // 8 bit bus on these dvices 00034 * LCDTFT MyLCD(PTB0,PTB1,PTB2,PTB3,PTC2,&MyBus);//LCDTFT(PinName PIN_RD,PinName PIN_WR,PinName PIN_RS,PinName PIN_CS,PinName PIN_RESET, BusOut *BUSLCD); 00035 * 00036 * 00037 *int main(){ 00038 * MyLCD.vLCDTFTInit(); 00039 * MyLCD.vLCDTFTFillScreen(ColorWhite); 00040 * MyLCD.printf("Hola mbed!!!"); 00041 * 00042 * MyLCD.vDrawImageBMP24Bits("IMG0.BMP"); 00043 * 00044 * while(1){ 00045 * } 00046 *} 00047 * @endcode 00048 */ 00049 00050 #include "mbed.h" 00051 #include "Fuentes.h" 00052 00053 #define Red 0xf800 00054 #define Green 0x400 00055 #define Blue 0x001f 00056 #define Marron 0x8208 00057 #define Black 0x0 00058 #define White 0xffff 00059 #define Maroon 0x8000 00060 #define Fuchsia 0xf81f 00061 #define Violet 0x801f 00062 #define SeaBlue 0x14 00063 #define Gray 0x8410 00064 #define Olive 0x8400 00065 #define Orange 0xfc08 00066 #define Yellow 0xffe0 00067 #define Cyan 0x87ff 00068 #define Pink 0xf810 00069 #define Navy 0x10 00070 #define Purple 0x8010 00071 #define Teal 0x410 00072 #define Lime 0x7e0 00073 #define Aqua 0x7ff 00074 00075 #define LCD_X_MAX 240 // these swapped 00076 #define LCD_Y_MAX 320 00077 00078 class LCDTFT: public Stream { 00079 public: 00080 /** Crea LCDTFT interface 00081 * 00082 * @param RD 00083 * @param WR 00084 * @param RS 00085 * @param CS 00086 * @param RESET 00087 * @param BusLCD (16-bits) 00088 */ 00089 LCDTFT(PinName PIN_RD,PinName PIN_WR,PinName PIN_RS,PinName PIN_CS,PinName PIN_RESET, BusOut *BUSLCD); 00090 /** Inicializa LCD 00091 * format =0 portrait and 1 for landscape 00092 */ 00093 void vLCDTFTInit(bool format); 00094 /** Fija parametros para escritura mediante printf 00095 * 00096 * @param Xo X inicial 00097 * @param Yo Y inicial 00098 * @param Xmin X minimo 00099 * @param Xmax X maximo 00100 * @param Alto Alto de letra (1,2,3..) 00101 * @param Color Color de letra 16-bits 00102 * and the background color for clearing 00103 */ 00104 void vLCDTFTSetParametersPrintf(unsigned short Xo,unsigned short Yo,unsigned short Xmin,unsigned short Xmax,unsigned char Alto, unsigned short Color, unsigned short BackColor); 00105 /** Pinta pantalla completa de color 00106 * @param Color Color de 16-bits 00107 */ 00108 void vLCDTFTFillScreen(unsigned short Color); 00109 /** Dibuja punto en pantalla 00110 * @param x Posicion x 00111 * @param y Posicion y 00112 * @param Color Color 16-bits 00113 */ 00114 void vLCDTFTPoint(unsigned short x,unsigned short y,unsigned short Color); 00115 /** Escribe string en LCD 00116 * @param x X inicial 00117 * @param y Y inicial 00118 * @param *PtrText Texto a escribir 00119 * @param *Fuente Fuente de letra a escribir (ARIAL) 00120 * @param Alto Alto de letra (1,2,3) 00121 * @param Color Color de 16-bits 00122 */ 00123 void vLCDTFTText(unsigned short x,unsigned short y,const char *PtrText,const char (*Fuente)[5],unsigned char Alto,unsigned short Color,unsigned short BackColor); 00124 00125 void vLCDTFTLine(unsigned short x1,unsigned short y1,unsigned short x2,unsigned short y2,unsigned short Color); 00126 void vLCDTFTRectangle(unsigned short x1,unsigned short y1,unsigned short x2,unsigned short y2,bool Filled,unsigned short Color); 00127 void vLCDTFTCircle(unsigned short x,unsigned short y,unsigned short Radius,bool Filled,unsigned short Color); 00128 /** Dibuja imagen ubicada en memoria de mbed (2Mbytes) centrada en patalla 00129 * @param NameImagen nombre de imagen (ejm: IMAGEN.BMP) 00130 */ 00131 void vDrawImageBMP24Bits(const char *NameImagen); 00132 void vLCDTFTDrawImage(unsigned short x,unsigned short y, unsigned short Width, unsigned short Heigh, unsigned int Lenght, const unsigned short *Imagen); 00133 #if DOXYGEN_ONLY 00134 /** Escribe un caracter en LCD 00135 * 00136 * @param c El caracter a escribir en LCD 00137 */ 00138 int putc(int c); 00139 00140 /** Escribe un string formateado en LCD 00141 * 00142 * @param format A printf-style format string, followed by the 00143 * variables to use in formating the string. 00144 */ 00145 int printf(const char* format, ...); 00146 #endif 00147 00148 private: 00149 DigitalOut LCD_PIN_RD,LCD_PIN_WR,LCD_PIN_RS,LCD_PIN_CS,LCD_PIN_RESET; 00150 BusOut *LCD_PORT; 00151 unsigned short X,Y,X_min,X_max,_Alto,_Color,_Background; 00152 // Stream implementation functions 00153 virtual int _putc(int value); 00154 virtual int _getc(); 00155 00156 virtual void vLCDTFTWriteCommand(unsigned short Data); 00157 virtual void vLCDTFTWriteData(unsigned short Data); 00158 virtual void vLCDTFTWriteCommandData(unsigned short CMD,unsigned short Data); 00159 virtual void vLCDTFTAddressSet(unsigned short x1,unsigned short y1,unsigned short x2,unsigned short y2); 00160 virtual void vLCDTFTAddressSetPoint(unsigned short x,unsigned short y); 00161 }; 00162 // **************************************************************************************************************************************
Generated on Sat Jul 23 2022 23:45:16 by
1.7.2
