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

Dependents:   AD128160_HelloWorld

Committer:
nucho
Date:
Mon Dec 12 02:38:49 2011 +0000
Revision:
2:6f2db745808e
Parent:
1:328d8c8f804e
Child:
3:d15cda2a5e91

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nucho 0:2e2f3b389d8a 1 #ifndef AD128160_H_
nucho 0:2e2f3b389d8a 2 #define AD128160_H_
nucho 0:2e2f3b389d8a 3
nucho 0:2e2f3b389d8a 4 #include "mbed.h"
nucho 0:2e2f3b389d8a 5
nucho 0:2e2f3b389d8a 6 #define LCD_ROWS 10
nucho 0:2e2f3b389d8a 7 #define LCD_COLS 16
nucho 2:6f2db745808e 8 #define LCD_WIDTH 128
nucho 2:6f2db745808e 9 #define LCD_HEIGHT 160
nucho 0:2e2f3b389d8a 10 /** An interface for the AD128160 LCD display
nucho 0:2e2f3b389d8a 11 *
nucho 0:2e2f3b389d8a 12 */
nucho 1:328d8c8f804e 13
nucho 0:2e2f3b389d8a 14 class AD128160: public Stream {
nucho 0:2e2f3b389d8a 15 public:
nucho 0:2e2f3b389d8a 16 /** Create and AD128160 interface, using a tx and one DigitalOut interfaces
nucho 0:2e2f3b389d8a 17 *
nucho 0:2e2f3b389d8a 18 * @param A serialport
nucho 0:2e2f3b389d8a 19 * @param reset A DigitalOut
nucho 0:2e2f3b389d8a 20 */
nucho 0:2e2f3b389d8a 21 AD128160(PinName tx,PinName reset);
nucho 0:2e2f3b389d8a 22
nucho 0:2e2f3b389d8a 23 /** Set a pixel on te screen
nucho 0:2e2f3b389d8a 24 *
nucho 0:2e2f3b389d8a 25 * @param x horizontal position from left
nucho 0:2e2f3b389d8a 26 * @param y vertical position from top
nucho 0:2e2f3b389d8a 27 */
nucho 0:2e2f3b389d8a 28 void pixel(int x0,int y0);
nucho 0:2e2f3b389d8a 29
nucho 0:2e2f3b389d8a 30 /** Draw a box on the screen
nucho 0:2e2f3b389d8a 31 *
nucho 0:2e2f3b389d8a 32 * @param x0 start point of box(X)
nucho 0:2e2f3b389d8a 33 * @param y0 start point of box(Y)
nucho 0:2e2f3b389d8a 34 * @param x1 end point of box(X)
nucho 0:2e2f3b389d8a 35 * @param y1 end poinrt of box(Y)
nucho 0:2e2f3b389d8a 36 * @param paint Setting the fill.If set of 1, fill of box.
nucho 0:2e2f3b389d8a 37 */
nucho 0:2e2f3b389d8a 38 void box(int x0,int y0,int x1,int y1,int paint);
nucho 0:2e2f3b389d8a 39
nucho 0:2e2f3b389d8a 40 /** Draw a line on the screen
nucho 0:2e2f3b389d8a 41 *
nucho 0:2e2f3b389d8a 42 * @param x0 start point of line(X)
nucho 0:2e2f3b389d8a 43 * @param y0 start point of line(Y)
nucho 0:2e2f3b389d8a 44 * @param x1 end point of line(X)
nucho 0:2e2f3b389d8a 45 * @param y1 end point of line(Y)
nucho 0:2e2f3b389d8a 46 */
nucho 0:2e2f3b389d8a 47 void line(int x0,int y0,int x1,int y1);
nucho 0:2e2f3b389d8a 48
nucho 0:2e2f3b389d8a 49 /** Draw a circle on the screen
nucho 0:2e2f3b389d8a 50 *
nucho 0:2e2f3b389d8a 51 * @param x0 center point of circle(X)
nucho 0:2e2f3b389d8a 52 * @param y0 centor point of circle(Y)
nucho 0:2e2f3b389d8a 53 * @param r circle of radius
nucho 0:2e2f3b389d8a 54 * @param paint Setting the fill.If set of 1, fill of circle.
nucho 0:2e2f3b389d8a 55 */
nucho 0:2e2f3b389d8a 56 void circle(int x0,int y0,int r,int paint);
nucho 0:2e2f3b389d8a 57
nucho 0:2e2f3b389d8a 58 /** Locate to a screen column and row
nucho 0:2e2f3b389d8a 59 *
nucho 0:2e2f3b389d8a 60 * @param column The horizontal position from the left, indexed from 0
nucho 0:2e2f3b389d8a 61 * @param row The vertical position from the top, indexed from 0
nucho 0:2e2f3b389d8a 62 */
nucho 0:2e2f3b389d8a 63 void locate(int column, int row);
nucho 0:2e2f3b389d8a 64
nucho 0:2e2f3b389d8a 65 /** Configure of the LCD's back light blightness
nucho 0:2e2f3b389d8a 66 *
nucho 0:2e2f3b389d8a 67 * @param value brightness value. range of 0-500
nucho 0:2e2f3b389d8a 68 */
nucho 0:2e2f3b389d8a 69 void brightness(int value);
nucho 0:2e2f3b389d8a 70
nucho 0:2e2f3b389d8a 71 /** Set a color
nucho 0:2e2f3b389d8a 72 *
nucho 0:2e2f3b389d8a 73 * @param color 2byte colour in format RGB:56
nucho 0:2e2f3b389d8a 74 */
nucho 0:2e2f3b389d8a 75 void color(int rgb);
nucho 0:2e2f3b389d8a 76
nucho 0:2e2f3b389d8a 77 /** Set a Text'd back ground olor
nucho 0:2e2f3b389d8a 78 *
nucho 0:2e2f3b389d8a 79 * @param color 2byte colour in format RGB:56
nucho 0:2e2f3b389d8a 80 */
nucho 0:2e2f3b389d8a 81 void backgroudColor(int rgb);
nucho 0:2e2f3b389d8a 82
nucho 0:2e2f3b389d8a 83 /** Configure of the LCD speed
nucho 0:2e2f3b389d8a 84 *
nucho 0:2e2f3b389d8a 85 * @param baud baudrate of the LCD
nucho 0:2e2f3b389d8a 86 */
nucho 0:2e2f3b389d8a 87 void speed(int baud);
nucho 0:2e2f3b389d8a 88
nucho 0:2e2f3b389d8a 89 /** Clear the screen and locate to 0,0 */
nucho 0:2e2f3b389d8a 90 void cls();
nucho 0:2e2f3b389d8a 91
nucho 0:2e2f3b389d8a 92 /** Reset of the LCD */
nucho 0:2e2f3b389d8a 93 void reset();
nucho 0:2e2f3b389d8a 94
nucho 0:2e2f3b389d8a 95 /** Write a string to the LCD
nucho 0:2e2f3b389d8a 96 *
nucho 0:2e2f3b389d8a 97 * @param s The string to write to the display
nucho 0:2e2f3b389d8a 98 */
nucho 0:2e2f3b389d8a 99 void puts(char s[98]);
nucho 0:2e2f3b389d8a 100
nucho 0:2e2f3b389d8a 101 #if DOXYGEN_ONLY
nucho 0:2e2f3b389d8a 102 /** Write a character to the LCD
nucho 0:2e2f3b389d8a 103 *
nucho 0:2e2f3b389d8a 104 * @param c The character to write to the display
nucho 0:2e2f3b389d8a 105 */
nucho 0:2e2f3b389d8a 106 int putc(int c);
nucho 0:2e2f3b389d8a 107
nucho 0:2e2f3b389d8a 108 /** Write a formated string to the LCD
nucho 0:2e2f3b389d8a 109 *
nucho 0:2e2f3b389d8a 110 * @param format A printf-style format string, followed by the
nucho 0:2e2f3b389d8a 111 * variables to use in formating the string.
nucho 0:2e2f3b389d8a 112 */
nucho 0:2e2f3b389d8a 113 int printf(const char* format, ...);
nucho 0:2e2f3b389d8a 114 #endif
nucho 2:6f2db745808e 115 /** get of the LCD width
nucho 2:6f2db745808e 116 *
nucho 2:6f2db745808e 117 * @return LCD width
nucho 2:6f2db745808e 118 */
nucho 2:6f2db745808e 119 int width();
nucho 2:6f2db745808e 120
nucho 2:6f2db745808e 121 /** get of the LCD height
nucho 2:6f2db745808e 122 *
nucho 2:6f2db745808e 123 * @return LCD height
nucho 2:6f2db745808e 124 */
nucho 2:6f2db745808e 125 int height();
nucho 2:6f2db745808e 126
nucho 2:6f2db745808e 127 /** get of the LCD width
nucho 2:6f2db745808e 128 *
nucho 2:6f2db745808e 129 * @return LCD colums
nucho 2:6f2db745808e 130 */
nucho 2:6f2db745808e 131 int columns();
nucho 2:6f2db745808e 132
nucho 2:6f2db745808e 133 /** get of the LCD width
nucho 2:6f2db745808e 134 *
nucho 2:6f2db745808e 135 * @return LCD rows
nucho 2:6f2db745808e 136 */
nucho 2:6f2db745808e 137 int rows();
nucho 0:2e2f3b389d8a 138
nucho 0:2e2f3b389d8a 139 void bmp(int x0,int y0,int bmp_n);
nucho 0:2e2f3b389d8a 140
nucho 0:2e2f3b389d8a 141 protected:
nucho 0:2e2f3b389d8a 142 void init();
nucho 0:2e2f3b389d8a 143 void newline(void);
nucho 0:2e2f3b389d8a 144 virtual int _putc(int c);
nucho 0:2e2f3b389d8a 145 virtual int _getc() {
nucho 0:2e2f3b389d8a 146 return 0;
nucho 0:2e2f3b389d8a 147 }
nucho 0:2e2f3b389d8a 148
nucho 0:2e2f3b389d8a 149 Serial _device; // tx, rx LCD
nucho 0:2e2f3b389d8a 150 DigitalOut _rst; // LCD RST (Reset)
nucho 0:2e2f3b389d8a 151
nucho 0:2e2f3b389d8a 152 int _row, _column;
nucho 0:2e2f3b389d8a 153
nucho 0:2e2f3b389d8a 154 };
nucho 0:2e2f3b389d8a 155
nucho 0:2e2f3b389d8a 156
nucho 0:2e2f3b389d8a 157 #endif