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:09:19 2011 +0000
Revision:
0:2e2f3b389d8a
Child:
1:328d8c8f804e

        

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