Version 6.0. Animaiton demo.
Dependents: MIP8f_FRDM_Animation_sample
MIP8F_SPI.h
00001 /** 00002 * @file MIP8F_SPI.h 00003 * @brief ver4.0 Library header file: Class for JDI MIP8 display 00004 * @details 00005 * Ver4.0 Addtional function is Line buffer version 00006 * Ver3.0 Addtional function is font display 00007 * ver2.0 Addtional function is Monochome display by 1bit mode of SPI transfer. 00008 * 00009 * <license> 00010 * Copyright 2018 Japan Display Inc. 00011 * Licensed under the Apache License, Version 2.0 (the "License"); 00012 * you may not use this file except in compliance with the License. 00013 * You may obtain a copy of the License at 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * Unless required by applicable law or agreed to in writing, software 00016 * distributed under the License is distributed on an "AS IS" BASIS, 00017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 * See the License for the specific language governing permissions and 00019 * limitations under the License. 00020 */ 00021 00022 #include "mbed.h" 00023 /***************************************** 00024 * Select compile option 00025 ******************************************/ 00026 /** 00027 * @def LINEBUFF_MODE 0 00028 * @brief If you will use a Line Buffer mode,you must define LINEBUFF_MODE 1 00029 */ 00030 #define LINEBUFF_MODE 0 00031 /** 00032 * @def FRAMEBUFF_MODE 1 00033 * @brief If you will use a Frame Buffer mode,you must define LINEBUFF_MODE 1 00034 */ 00035 #define FRAMEBUFF_MODE 1 00036 00037 #define MOVIEBUFF_MODE 1 00038 /***************************************** 00039 ******************************************/ 00040 #if LINEBUFF_MODE 00041 // 1dot = 4bit 00042 #define LINE_SIZE 320 // 640 / 2 00043 #endif 00044 #if FRAMEBUFF_MODE 00045 //#define FRAME_SIZE 9328 //1flame = 212dot X 88dot 1dot = 4bit 00046 #define FRAME_SIZE 153600 // 153600 640 x 480 103600 400dot x 200dot 1dot = 4bit 00047 #endif 00048 #if MOVIEBUFF_MODE 00049 #define MOVIE_SIZE 3200 // 80x80/2 00050 #define MOVIE_NUM 10 00051 #define MOVIE_VERT_SIZE 80 00052 #define MOVIE_HORI_SIZE 80 00053 #endif 00054 00055 // RGB color definitions /* R, G, B */ 00056 #define Black 0x00 /* 0 0 0 */ 00057 #define Blue 0x02 /* 0 0 1 */ 00058 #define Green 0x04 /* 0 1 0 */ 00059 #define Cyan 0x06 /* 0 1 1 */ 00060 #define Red 0x08 /* 1 0 0 */ 00061 #define Magenta 0x0a /* 1 0 1 */ 00062 #define Yellow 0x0c /* 1 1 0 */ 00063 #define White 0x0e /* 1 1 1 */ 00064 00065 //transfer mode 00066 #define TrBIT4 0x00 00067 #define TrBIT3 0x01 00068 #define TrBIT1 0x02 00069 00070 #define RGB8(r,g,b) (((r & 0x80) >>4) | ((g & 0x80)>>5) | ((b & 0x80)>>6) ) & 0x0E //24bit->4bit ??6bit(8bit)?? MIP MASK 0000 1110?? 00071 00072 /** 00073 * @brief display class for JDI MIP8(memory in pixel 8 color display) 00074 * @details spi-transfer has 3 mode. 00075 * 4bit mode is color display, this bit arrange is R,G,B,x. R,G,B = R,G,B subpixel bit. a x bit is Dummy. 00076 * No ues(3bit mode is color display, this bit arrange is R,G,B. R,G,B = R,G,B subpixel bit. No bit is Dummy.) 00077 * 1bit mode is monocrome display,high speed refresh mode. a only Green subpixel of bitmap data is transfered. 00078 */ 00079 class memLCD8 : public Stream { 00080 public: 00081 00082 unsigned char* font; 00083 00084 /** 00085 * @brief Constructor : Set MPU pin names 00086 */ 00087 memLCD8(PinName mosi,PinName miso,PinName sclk,PinName cs,PinName disp,PinName power); 00088 void locate(int x, int y); 00089 void set_font(unsigned char* f); 00090 void setWH(int width, int height); 00091 void SwDisp(bool ONorOFF); 00092 void foreground(uint8_t colour); 00093 void background(uint8_t colour); 00094 void command(char command); 00095 //ver2.0 00096 void SetTransfermode(int transfermode); 00097 00098 //ver3.0 00099 void set_FixedFontWidth( unsigned char width ); 00100 void set_ActualFontWidth(void); 00101 unsigned char get_Background(void); 00102 00103 #if LINEBUFF_MODE 00104 //ver3.0 00105 void pixel(int x, uint8_t color); 00106 void clsLINEBUF(void); 00107 int* GetPixelValueFromLineBuffer(int _x,uint8_t* buff); 00108 void writeDISPLinebuffer(void); 00109 void writeDISP(int line,int transfermode); 00110 #endif 00111 00112 #if FRAMEBUFF_MODE 00113 void pixel(int x, int y, uint8_t color); 00114 void writeDISP(void); 00115 void writeDISP(int transfermode);// transfermode : 4bit,3bit,1bit 00116 void writeDISP(int startline , int endline , int transfermode);// refresh display selected line 00117 void clsBUF(void); 00118 void setmarge(bool ifMarge); 00119 void character(int x, int y, int c); 00120 void circle(int x0, int y0, int r, uint8_t color); 00121 void fillcircle(int x0, int y0, int r, uint8_t color); 00122 void hline(int x0, int x1, int y, uint8_t color); 00123 void vline(int x, int y0, int y1, uint8_t color); 00124 void line(int x0, int y0, int x1, int y1, uint8_t color); 00125 void rect(int x0, int y0, int x1, int y1, uint8_t color); 00126 void fillrect(int x0, int y0, int x1, int y1, uint8_t color); 00127 void Symbol(unsigned int x, unsigned int y, unsigned char *symbol); 00128 //ver2.0 00129 int* GetPixelValue(int x , int y , uint8_t* buff); 00130 //ver3.0 00131 int textout(int x,int y,char* text); 00132 void oblique(int x, int y, int c); 00133 int obliqueout(int x,int y,char* text); 00134 #endif 00135 #if MOVIEBUFF_MODE 00136 void movie_pixel(int x, int y, uint8_t color,int memnum); 00137 void makeMovieFrame(int sx , int sy, int memnum); 00138 void makeMovieFrame_Reverse(int sx , int sy, int memnum); 00139 void makeMovieFrame_Updown(int sx , int sy, int memnum); 00140 void RestoreMovieFrame(int sx , int sy, int memnum); 00141 #endif 00142 protected: 00143 virtual int _putc(int value); 00144 virtual int _getc(); 00145 00146 //! SPI class 00147 SPI _spi; 00148 //! pin class , SPI line 00149 DigitalOut _cs; 00150 //! display on/off 00151 DigitalOut _disp; 00152 //! diplay power on/off 00153 DigitalOut _power; 00154 00155 //! foreground color of display 00156 char _foreground; 00157 //! background color of display 00158 char _background; 00159 bool _ifMarge; 00160 char _if16; 00161 00162 //ver3.0 00163 //! Fixed Font width size if _FixedFontWidth==0, use actual Font width size. 00164 unsigned char _FixedFontWidth; 00165 00166 #if FRAMEBUFF_MODE 00167 //! frame buffer for display 00168 uint8_t _dispBUF[FRAME_SIZE]; 00169 //uint8_t _LayerBUF[FRAME_SIZE]; 00170 #endif 00171 #if LINEBUFF_MODE 00172 //uint8_t *_pLineBuf; 00173 //! line buffer for display 00174 uint8_t _dispLINEBUF[LINE_SIZE]; 00175 #endif 00176 //! height,diplay pixel size 00177 int _height; 00178 //! width,diplay pixel size 00179 int _width; 00180 unsigned int char_x; 00181 unsigned int char_y; 00182 00183 #if MOVIEBUFF_MODE 00184 uint8_t _dispMOVIEBUF[MOVIE_NUM][MOVIE_SIZE]; 00185 //int movie_height; 00186 //int movie_width; 00187 uint8_t _dispBACKUPBUF[MOVIE_SIZE]; 00188 #endif 00189 00190 //ver2.0 00191 //! SPI transfer mode command to MIP8 diplay 00192 char TrModeCommand; 00193 int TrAdd; 00194 int TrValue[3]; 00195 int TrValNum; 00196 };
Generated on Tue Jul 12 2022 20:54:09 by 1.7.2