AD-128160-UART制御用のライブラリ http://www.aitendo.co.jp/product/3119 gingaxさんのプログラムを参考に作らせてもらっています。 http://mbed.org/users/akira/libraries/AD128160/m159hi

Dependents:   AD128160_HelloWorld

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers AD128160.h Source File

AD128160.h

00001 #ifndef AD128160_H_
00002 #define AD128160_H_
00003 
00004 #include "mbed.h"
00005 
00006 //#define LCD_ROWS 10
00007 //#define LCD_COLS 16
00008 #define LCD_WIDTH 128
00009 #define LCD_HEIGHT 160
00010 /** An interface for the AD128160 LCD display
00011  *
00012  */
00013  
00014 class AD128160: public Stream {
00015 public:
00016     /** Create and AD128160 interface, using a tx and one DigitalOut interfaces
00017      *
00018      * @param tx A serialport(tx)
00019      * @param reset A DigitalOut
00020      */
00021     AD128160(PinName tx,PinName reset);
00022     
00023     /** Set a pixel on te screen
00024     *
00025     * @param x horizontal position from left
00026     * @param y vertical position from top
00027     */
00028     void pixel(int x0,int y0);
00029     
00030     /** Draw a box on the screen
00031     *
00032     * @param x0 start point of box(X)
00033     * @param y0 start point of box(Y)
00034     * @param x1 end point of box(X)
00035     * @param y1 end poinrt of box(Y)
00036     * @param paint Setting the fill.If set of 1, fill of box.
00037     */
00038     void box(int x0,int y0,int x1,int y1,int paint);
00039     
00040     /** Draw a line on the screen
00041     *
00042     * @param x0 start point of line(X)
00043     * @param y0 start point of line(Y)
00044     * @param x1 end point of line(X)
00045     * @param y1 end point of line(Y)
00046     */
00047     void line(int x0,int y0,int x1,int y1);
00048     
00049     /** Draw a circle on the screen
00050     *
00051     * @param x0 center point of circle(X)
00052     * @param y0 centor point of circle(Y)
00053     * @param r circle of radius
00054     * @param paint Setting the fill.If set of 1, fill of circle.
00055     */
00056     void circle(int x0,int y0,int r,int paint);
00057     
00058     /** Locate to a screen column and row
00059      *
00060      * @param column  The horizontal position from the left, indexed from 0
00061      * @param row     The vertical position from the top, indexed from 0
00062      */
00063     void locate(int column, int row);  
00064 
00065     /** Configure of the LCD's back light blightness
00066      *
00067      * @param value brightness value. range of 0-500
00068      */ 
00069     void brightness(int value);
00070 
00071     /** Set a color
00072     *
00073     * @param rgb 2byte colour in format RGB:56
00074     */
00075     void color(int rgb);
00076 
00077     /** Setting a text back ground
00078     *
00079     * @param mode   If mode is true,text'backgroud is on.
00080     * @param rgb  2byte colour in format RGB:565
00081     */
00082     void textBackground(bool mode,int rgb);
00083     
00084     /** Configure of the LCD speed
00085     *
00086     * @param baud baudrate of the LCD
00087     */
00088     void speed(int baud);
00089 
00090     /** Clear the screen and locate to 0,0 */
00091     void cls();
00092 
00093     /** Reset of the LCD */
00094     void reset();
00095 
00096     /** Write a string to the LCD
00097      *
00098      * @param s The string to write to the display
00099      */
00100     void puts(char* s);
00101     
00102     /** Setting a text size and color.If this function, column and row is 0,0.
00103      * 
00104      * @param size text size(0:6x10 1:7x13 2:8x16 3:10x20 4:16x32)
00105      * @param rgb  2byte colour in format RGB:565
00106      */
00107     void textSetting(int size,int rgb);
00108     
00109 #if DOXYGEN_ONLY
00110     /** Write a character to the LCD
00111      *
00112      * @param c The character to write to the display
00113      */
00114     int putc(int c);
00115 
00116     /** Write a formated string to the LCD
00117      *
00118      * @param format A printf-style format string, followed by the
00119      *               variables to use in formating the string.
00120      */
00121     int printf(const char* format, ...);
00122 #endif
00123     /** get of the LCD width
00124     *
00125     * @return LCD width
00126     */
00127     int width();
00128     
00129     /** get of the LCD height
00130     *
00131     * @return LCD height
00132     */
00133     int height();
00134     
00135     /** get of the LCD colums
00136     *
00137     * @return LCD colums
00138     */
00139     int columns();
00140     
00141     /** get of the LCD rows
00142     *
00143     * @return LCD rows
00144     */
00145     int rows();
00146 
00147     void bmp(int x0,int y0,int bmp_n);
00148     
00149 protected:
00150 void init();
00151     void newline();
00152     void cwrite(int command,unsigned char* data,int length);
00153     virtual int _putc(int c);
00154     virtual int _getc() {
00155         return 0;
00156     }
00157 
00158     Serial _device;  // tx
00159     DigitalOut _rst;     // LCD  RST  (Reset)
00160     int _row, _column;//now row and col
00161     int _font_x,_font_y;//font size
00162     int _max_columns,_max_rows;//max row and col
00163 
00164 };
00165 
00166 
00167 #endif