Version 2.0. MIP8 Frame Buffer Libraly. Addtional function is monochrome display by 1bit transfer mode . it is high speed refresh rate.

Dependents:   MIP8f_FRDM_sample MIP8f_FRDM_MonochromeDisplay_sample

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MIP8F_SPI.h Source File

MIP8F_SPI.h

Go to the documentation of this file.
00001 /**
00002 * @file MIP8F_SPI.h
00003 * @brief Library header file: Class for JDI MIP8 display
00004 * @details  
00005 * <license>
00006 * Copyright 2018 Japan Display Inc.
00007 * Licensed under the Apache License, Version 2.0 (the "License");
00008 * you may not use this file except in compliance with the License.
00009 * You may obtain a copy of the License at
00010 *     http://www.apache.org/licenses/LICENSE-2.0
00011 * Unless required by applicable law or agreed to in writing, software
00012 * distributed under the License is distributed on an "AS IS" BASIS,
00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014 * See the License for the specific language governing permissions and
00015 * limitations under the License.
00016 */
00017 
00018 #include "mbed.h"
00019 /*****************************************
00020 * Select compile option
00021 ******************************************/
00022 /**
00023 * @def LINEBUFF_MODE
00024 * @ brief If you will use a Line Buffer mode,you must define LINEBUFF_MODE 
00025 */
00026 //#define LINEBUFF_MODE
00027 /*****************************************
00028 ******************************************/
00029 #ifdef LINEBUFF_MODE
00030     //  1dot = 4bit
00031     #define LINE_SIZE  320  // 640 / 2
00032 #else
00033     //#define FRAME_SIZE 9328  //1flame = 212dot X 88dot  1dot = 4bit
00034     #define FRAME_SIZE  153600  //  153600 640 x 480        103600  400dot x 200dot    1dot = 4bit
00035 #endif
00036 
00037 // RGB color definitions       /*  R, G, B  */
00038 #define Black           0x00    /*  0  0  0  */
00039 #define Blue            0x02    /*  0  0  1  */
00040 #define Green           0x04    /*  0  1  0  */
00041 #define Cyan            0x06    /*  0  1  1  */
00042 #define Red             0x08    /*  1  0  0  */
00043 #define Magenta         0x0a    /*  1  0  1  */ 
00044 #define Yellow          0x0c    /*  1  1  0  */
00045 #define White           0x0e    /*  1  1  1  */
00046 
00047 //transfer mode
00048 #define TrBIT4    0x00
00049 #define TrBIT3    0x01
00050 #define TrBIT1    0x02
00051     
00052 #define RGB8(r,g,b)   (((r & 0x80) >>4) | ((g & 0x80)>>5) | ((b & 0x80)>>6) ) & 0x0E  //24bit->4bit ??6bit(8bit)?? MIP  MASK 0000 1110??
00053 
00054 
00055 /**
00056 * @brief display class for JDI MIP8(memory in pixel 8 color display)
00057 * @details spi-transfer has 3 mode. 
00058 * 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.
00059 * 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.)
00060 * 1bit mode is monocrome display,high speed refresh mode. a only Green subpixel of bitmap data is transfered.
00061 */ 
00062 class memLCD8 : public Stream {
00063 public:
00064 
00065 /**
00066 * @brief Constructor : Set MPU pin names
00067 */
00068     memLCD8(PinName mosi,PinName miso,PinName sclk,PinName cs,PinName disp,PinName power); 
00069 #ifndef LINEBUFF_MODE
00070     void  writeDISP(void);
00071     void  writeDISP(int transfermode);           // transfermode : 4bit,3bit,1bit
00072     void  pixel(int x, int y, uint8_t color);     //for framebuffer
00073 #else
00074     void  writeDISP(int line,int transfermode);// for linebuffer
00075     void  pixel(int x, uint8_t color);           // for linebuffer
00076 #endif
00077     void  clsBUF(void);
00078     void  locate(int x, int y);
00079     void foreground(uint8_t colour);
00080     void background(uint8_t colour);
00081     void command(char command);
00082     void setmarge(bool ifMarge);
00083     void setWH(int width, int height);
00084     void SwDisp(bool ONorOFF);
00085     void character(int x, int y, int c);
00086 //    void LayerCopy(void);
00087     void circle(int x0, int y0, int r, uint8_t color);
00088     void fillcircle(int x0, int y0, int r, uint8_t color);
00089     void hline(int x0, int x1, int y, uint8_t color);
00090     void vline(int x, int y0, int y1, uint8_t color);
00091     void line(int x0, int y0, int x1, int y1, uint8_t color);
00092     void rect(int x0, int y0, int x1, int y1, uint8_t color);
00093     void fillrect(int x0, int y0, int x1, int y1, uint8_t color);
00094     void Symbol(unsigned int x, unsigned int y, unsigned char *symbol);
00095     void set_font(unsigned char* f);
00096     unsigned char* font;
00097     //ver2.0
00098     void SetTransfermode(int transfermode);
00099     int* GetPixelValue(int x , int y , uint8_t* buff);
00100 protected:
00101     virtual int _putc(int value);
00102     virtual int _getc();
00103 
00104     //! SPI class
00105     SPI _spi;
00106     //! pin class , SPI line 
00107     DigitalOut _cs;
00108     //! display on/off
00109     DigitalOut _disp;
00110     //! diplay power on/off
00111     DigitalOut _power;
00112         
00113     //! foreground color of display
00114     char _foreground;
00115     //! background color of display
00116     char _background;
00117     bool _ifMarge;
00118     char _if16;
00119         
00120 #ifndef LINEBUFF_MODE
00121     //! frame buffer for display
00122     uint8_t _dispBUF[FRAME_SIZE];
00123     //uint8_t _LayerBUF[FRAME_SIZE];
00124 #else
00125     //uint8_t *_pLineBuf;
00126     //! line buffer for display
00127     uint8_t _dispBUF[LINE_SIZE];
00128 #endif
00129 
00130     //! height,diplay pixel size 
00131     int _height;
00132     //! width,diplay pixel size 
00133     int _width;
00134     unsigned int char_x;
00135     unsigned int char_y;
00136     
00137     //ver2.0
00138     //! SPI transfer mode command to MIP8 diplay
00139     char TrModeCommand;
00140     int TrAdd;
00141     int TrValue[3];
00142     int TrValNum;
00143 };