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
Introduction
This wiki page is the sample library for JDI-MIP display. (Use Frame buffer)
Test Board
This library code is confirmed on FRDM-K64F(NXP) with MIP8f FRDM Sample.
API
refer to API Documentation
Sample Project
Color Display::: https://os.mbed.com/teams/JapanDisplayInc/code/MIP8f_FRDM_sample/ https://os.mbed.com/teams/JapanDisplayInc/code/MIP8f_FRDM_sample/wiki/MIP8f-FRDM-Sample
Monochrome Display::: https://os.mbed.com/teams/JapanDisplayInc/code/MIP8f_FRDM_MonochromeDisplay_sample/ https://os.mbed.com/teams/JapanDisplayInc/code/MIP8f_FRDM_MonochromeDisplay_sample/wiki/Homepage
Diff: MIP8F_SPI.h
- Revision:
- 0:b2d46804658c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MIP8F_SPI.h Mon Oct 22 04:21:43 2018 +0000 @@ -0,0 +1,143 @@ +/** +* @file MIP8F_SPI.h +* @brief Library header file: Class for JDI MIP8 display +* @details +* <license> +* Copyright 2018 Japan Display Inc. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* http://www.apache.org/licenses/LICENSE-2.0 +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include "mbed.h" +/***************************************** +* Select compile option +******************************************/ +/** +* @def LINEBUFF_MODE +* @ brief If you will use a Line Buffer mode,you must define LINEBUFF_MODE +*/ +//#define LINEBUFF_MODE +/***************************************** +******************************************/ +#ifdef LINEBUFF_MODE + // 1dot = 4bit + #define LINE_SIZE 320 // 640 / 2 +#else + //#define FRAME_SIZE 9328 //1flame = 212dot X 88dot 1dot = 4bit + #define FRAME_SIZE 153600 // 153600 640 x 480 103600 400dot x 200dot 1dot = 4bit +#endif + +// RGB color definitions /* R, G, B */ +#define Black 0x00 /* 0 0 0 */ +#define Blue 0x02 /* 0 0 1 */ +#define Green 0x04 /* 0 1 0 */ +#define Cyan 0x06 /* 0 1 1 */ +#define Red 0x08 /* 1 0 0 */ +#define Magenta 0x0a /* 1 0 1 */ +#define Yellow 0x0c /* 1 1 0 */ +#define White 0x0e /* 1 1 1 */ + +//transfer mode +#define TrBIT4 0x00 +#define TrBIT3 0x01 +#define TrBIT1 0x02 + +#define RGB8(r,g,b) (((r & 0x80) >>4) | ((g & 0x80)>>5) | ((b & 0x80)>>6) ) & 0x0E //24bit->4bit ??6bit(8bit)?? MIP MASK 0000 1110?? + + +/** +* @brief display class for JDI MIP8(memory in pixel 8 color display) +* @details spi-transfer has 3 mode. +* 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. +* 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.) +* 1bit mode is monocrome display,high speed refresh mode. a only Green subpixel of bitmap data is transfered. +*/ +class memLCD8 : public Stream { +public: + +/** +* @brief Constructor : Set MPU pin names +*/ + memLCD8(PinName mosi,PinName miso,PinName sclk,PinName cs,PinName disp,PinName power); +#ifndef LINEBUFF_MODE + void writeDISP(void); + void writeDISP(int transfermode); // transfermode : 4bit,3bit,1bit + void pixel(int x, int y, uint8_t color); //for framebuffer +#else + void writeDISP(int line,int transfermode);// for linebuffer + void pixel(int x, uint8_t color); // for linebuffer +#endif + void clsBUF(void); + void locate(int x, int y); + void foreground(uint8_t colour); + void background(uint8_t colour); + void command(char command); + void setmarge(bool ifMarge); + void setWH(int width, int height); + void SwDisp(bool ONorOFF); + void character(int x, int y, int c); +// void LayerCopy(void); + void circle(int x0, int y0, int r, uint8_t color); + void fillcircle(int x0, int y0, int r, uint8_t color); + void hline(int x0, int x1, int y, uint8_t color); + void vline(int x, int y0, int y1, uint8_t color); + void line(int x0, int y0, int x1, int y1, uint8_t color); + void rect(int x0, int y0, int x1, int y1, uint8_t color); + void fillrect(int x0, int y0, int x1, int y1, uint8_t color); + void Symbol(unsigned int x, unsigned int y, unsigned char *symbol); + void set_font(unsigned char* f); + unsigned char* font; + //ver2.0 + void SetTransfermode(int transfermode); + int* GetPixelValue(int x , int y , uint8_t* buff); +protected: + virtual int _putc(int value); + virtual int _getc(); + + //! SPI class + SPI _spi; + //! pin class , SPI line + DigitalOut _cs; + //! display on/off + DigitalOut _disp; + //! diplay power on/off + DigitalOut _power; + + //! foreground color of display + char _foreground; + //! background color of display + char _background; + bool _ifMarge; + char _if16; + +#ifndef LINEBUFF_MODE + //! frame buffer for display + uint8_t _dispBUF[FRAME_SIZE]; + //uint8_t _LayerBUF[FRAME_SIZE]; +#else + //uint8_t *_pLineBuf; + //! line buffer for display + uint8_t _dispBUF[LINE_SIZE]; +#endif + + //! height,diplay pixel size + int _height; + //! width,diplay pixel size + int _width; + unsigned int char_x; + unsigned int char_y; + + //ver2.0 + //! SPI transfer mode command to MIP8 diplay + char TrModeCommand; + int TrAdd; + int TrValue[3]; + int TrValNum; +};