Erik -
/
Mini_DK_clk
Simple clock program for LPC1768 Mini-DK
Mini_DK/SPI_TFT/SPI_TFT.h@0:ab0aec01b38e, 2012-12-30 (annotated)
- Committer:
- Sissors
- Date:
- Sun Dec 30 21:31:56 2012 +0000
- Revision:
- 0:ab0aec01b38e
v0.1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sissors | 0:ab0aec01b38e | 1 | // mbed library for 240*320 pixel display TFT |
Sissors | 0:ab0aec01b38e | 2 | |
Sissors | 0:ab0aec01b38e | 3 | #ifndef MBED_SPI_TFT_H |
Sissors | 0:ab0aec01b38e | 4 | #define MBED_SPI_TFT_H |
Sissors | 0:ab0aec01b38e | 5 | |
Sissors | 0:ab0aec01b38e | 6 | |
Sissors | 0:ab0aec01b38e | 7 | #include "GraphicsDisplay.h" |
Sissors | 0:ab0aec01b38e | 8 | #include "mbed.h" |
Sissors | 0:ab0aec01b38e | 9 | |
Sissors | 0:ab0aec01b38e | 10 | #define incx() x++, dxt += d2xt, t += dxt |
Sissors | 0:ab0aec01b38e | 11 | #define incy() y--, dyt += d2yt, t += dyt |
Sissors | 0:ab0aec01b38e | 12 | |
Sissors | 0:ab0aec01b38e | 13 | #define SPI_F_LO 10000000 |
Sissors | 0:ab0aec01b38e | 14 | #define SPI_F_HI 48000000 |
Sissors | 0:ab0aec01b38e | 15 | |
Sissors | 0:ab0aec01b38e | 16 | /* some RGB565 color definitions */ |
Sissors | 0:ab0aec01b38e | 17 | #define Black 0x0000 /* 0, 0, 0 */ |
Sissors | 0:ab0aec01b38e | 18 | #define Navy 0x000F /* 0, 0, 128 */ |
Sissors | 0:ab0aec01b38e | 19 | #define DarkGreen 0x03E0 /* 0, 128, 0 */ |
Sissors | 0:ab0aec01b38e | 20 | #define DarkCyan 0x03EF /* 0, 128, 128 */ |
Sissors | 0:ab0aec01b38e | 21 | #define Maroon 0x7800 /* 128, 0, 0 */ |
Sissors | 0:ab0aec01b38e | 22 | #define Purple 0x780F /* 128, 0, 128 */ |
Sissors | 0:ab0aec01b38e | 23 | #define Olive 0x7BE0 /* 128, 128, 0 */ |
Sissors | 0:ab0aec01b38e | 24 | #define LightGrey 0xC618 /* 192, 192, 192 */ |
Sissors | 0:ab0aec01b38e | 25 | #define DarkGrey 0x7BEF /* 128, 128, 128 */ |
Sissors | 0:ab0aec01b38e | 26 | #define Blue 0x001F /* 0, 0, 255 */ |
Sissors | 0:ab0aec01b38e | 27 | #define Green 0x07E0 /* 0, 255, 0 */ |
Sissors | 0:ab0aec01b38e | 28 | #define Cyan 0x07FF /* 0, 255, 255 */ |
Sissors | 0:ab0aec01b38e | 29 | #define Red 0xF800 /* 255, 0, 0 */ |
Sissors | 0:ab0aec01b38e | 30 | #define Magenta 0xF81F /* 255, 0, 255 */ |
Sissors | 0:ab0aec01b38e | 31 | #define Yellow 0xFFE0 /* 255, 255, 0 */ |
Sissors | 0:ab0aec01b38e | 32 | #define White 0xFFFF /* 255, 255, 255 */ |
Sissors | 0:ab0aec01b38e | 33 | #define Orange 0xFD20 /* 255, 165, 0 */ |
Sissors | 0:ab0aec01b38e | 34 | #define GreenYellow 0xAFE5 /* 173, 255, 47 */ |
Sissors | 0:ab0aec01b38e | 35 | |
Sissors | 0:ab0aec01b38e | 36 | class SPI_TFT : public GraphicsDisplay { |
Sissors | 0:ab0aec01b38e | 37 | public: |
Sissors | 0:ab0aec01b38e | 38 | |
Sissors | 0:ab0aec01b38e | 39 | /** Create a SPI_TFT object connected to SPI and two pins |
Sissors | 0:ab0aec01b38e | 40 | * |
Sissors | 0:ab0aec01b38e | 41 | * @param mosi,miso,sclk SPI |
Sissors | 0:ab0aec01b38e | 42 | * @param cs pin connected to CS of display |
Sissors | 0:ab0aec01b38e | 43 | * @param reset pin connected to RESET of display |
Sissors | 0:ab0aec01b38e | 44 | * |
Sissors | 0:ab0aec01b38e | 45 | */ |
Sissors | 0:ab0aec01b38e | 46 | SPI_TFT(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset,const char* name ="TFT"); |
Sissors | 0:ab0aec01b38e | 47 | |
Sissors | 0:ab0aec01b38e | 48 | /** Get the width of the screen in pixel |
Sissors | 0:ab0aec01b38e | 49 | * |
Sissors | 0:ab0aec01b38e | 50 | * @param |
Sissors | 0:ab0aec01b38e | 51 | * @returns width of screen in pixel |
Sissors | 0:ab0aec01b38e | 52 | * |
Sissors | 0:ab0aec01b38e | 53 | */ |
Sissors | 0:ab0aec01b38e | 54 | virtual int width(); |
Sissors | 0:ab0aec01b38e | 55 | |
Sissors | 0:ab0aec01b38e | 56 | /** Get the height of the screen in pixel |
Sissors | 0:ab0aec01b38e | 57 | * |
Sissors | 0:ab0aec01b38e | 58 | * @returns height of screen in pixel |
Sissors | 0:ab0aec01b38e | 59 | * |
Sissors | 0:ab0aec01b38e | 60 | */ |
Sissors | 0:ab0aec01b38e | 61 | virtual int height(); |
Sissors | 0:ab0aec01b38e | 62 | |
Sissors | 0:ab0aec01b38e | 63 | /** Draw a pixel at x,y with color |
Sissors | 0:ab0aec01b38e | 64 | * |
Sissors | 0:ab0aec01b38e | 65 | * @param x horizontal position |
Sissors | 0:ab0aec01b38e | 66 | * @param y vertical position |
Sissors | 0:ab0aec01b38e | 67 | * @param color 16 bit pixel color |
Sissors | 0:ab0aec01b38e | 68 | */ |
Sissors | 0:ab0aec01b38e | 69 | virtual void pixel(int x, int y,int colour); |
Sissors | 0:ab0aec01b38e | 70 | |
Sissors | 0:ab0aec01b38e | 71 | /** draw a 1 pixel line |
Sissors | 0:ab0aec01b38e | 72 | * |
Sissors | 0:ab0aec01b38e | 73 | * @param x0,y0 start point |
Sissors | 0:ab0aec01b38e | 74 | * @param x1,y1 stop point |
Sissors | 0:ab0aec01b38e | 75 | * @param color 16 bit color |
Sissors | 0:ab0aec01b38e | 76 | * |
Sissors | 0:ab0aec01b38e | 77 | */ |
Sissors | 0:ab0aec01b38e | 78 | void line(int x0, int y0, int x1, int y1, int colour); |
Sissors | 0:ab0aec01b38e | 79 | |
Sissors | 0:ab0aec01b38e | 80 | /** draw a rect |
Sissors | 0:ab0aec01b38e | 81 | * |
Sissors | 0:ab0aec01b38e | 82 | * @param x0,y0 top left corner |
Sissors | 0:ab0aec01b38e | 83 | * @param w,h width and height |
Sissors | 0:ab0aec01b38e | 84 | * @param color 16 bit color |
Sissors | 0:ab0aec01b38e | 85 | * * |
Sissors | 0:ab0aec01b38e | 86 | */ |
Sissors | 0:ab0aec01b38e | 87 | void rect(int x0, int y0, int w, int h, int colour); |
Sissors | 0:ab0aec01b38e | 88 | |
Sissors | 0:ab0aec01b38e | 89 | /** draw a filled rect |
Sissors | 0:ab0aec01b38e | 90 | * |
Sissors | 0:ab0aec01b38e | 91 | * @param x0,y0 top left corner |
Sissors | 0:ab0aec01b38e | 92 | * @param w,h width and height |
Sissors | 0:ab0aec01b38e | 93 | * @param color 16 bit color |
Sissors | 0:ab0aec01b38e | 94 | * |
Sissors | 0:ab0aec01b38e | 95 | */ |
Sissors | 0:ab0aec01b38e | 96 | void fillrect(int x0, int y0, int w, int h, int colour); |
Sissors | 0:ab0aec01b38e | 97 | |
Sissors | 0:ab0aec01b38e | 98 | /** draw an ellipse - source : http://enchantia.com/graphapp/doc/tech/ellipses.html |
Sissors | 0:ab0aec01b38e | 99 | * |
Sissors | 0:ab0aec01b38e | 100 | * @param xc,yc center point |
Sissors | 0:ab0aec01b38e | 101 | * @param a,b semi-major axis and semi-minor axis |
Sissors | 0:ab0aec01b38e | 102 | * @param color 16 bit color |
Sissors | 0:ab0aec01b38e | 103 | * |
Sissors | 0:ab0aec01b38e | 104 | */ |
Sissors | 0:ab0aec01b38e | 105 | void draw_ellipse(int xc, int yc, int a, int b, unsigned int color); |
Sissors | 0:ab0aec01b38e | 106 | |
Sissors | 0:ab0aec01b38e | 107 | /** draw a filled ellipse - source : http://enchantia.com/graphapp/doc/tech/ellipses.html |
Sissors | 0:ab0aec01b38e | 108 | * |
Sissors | 0:ab0aec01b38e | 109 | * @param xc,yc center point |
Sissors | 0:ab0aec01b38e | 110 | * @param a,b semi-major axis and semi-minor axis |
Sissors | 0:ab0aec01b38e | 111 | * @param color 16 bit color |
Sissors | 0:ab0aec01b38e | 112 | * |
Sissors | 0:ab0aec01b38e | 113 | */ |
Sissors | 0:ab0aec01b38e | 114 | void fill_ellipse(int xc, int yc, int a, int b, unsigned int color); |
Sissors | 0:ab0aec01b38e | 115 | |
Sissors | 0:ab0aec01b38e | 116 | /** setup cursor position |
Sissors | 0:ab0aec01b38e | 117 | * |
Sissors | 0:ab0aec01b38e | 118 | * @param x x-position (top left) |
Sissors | 0:ab0aec01b38e | 119 | * @param y y-position |
Sissors | 0:ab0aec01b38e | 120 | */ |
Sissors | 0:ab0aec01b38e | 121 | virtual void locate(int x, int y); |
Sissors | 0:ab0aec01b38e | 122 | |
Sissors | 0:ab0aec01b38e | 123 | /** Fill the screen with _backgroun color |
Sissors | 0:ab0aec01b38e | 124 | * |
Sissors | 0:ab0aec01b38e | 125 | */ |
Sissors | 0:ab0aec01b38e | 126 | virtual void cls (void); |
Sissors | 0:ab0aec01b38e | 127 | |
Sissors | 0:ab0aec01b38e | 128 | /** Read ILI9320 ID |
Sissors | 0:ab0aec01b38e | 129 | * |
Sissors | 0:ab0aec01b38e | 130 | * @returns LCD ID code |
Sissors | 0:ab0aec01b38e | 131 | * |
Sissors | 0:ab0aec01b38e | 132 | */ |
Sissors | 0:ab0aec01b38e | 133 | unsigned short Read_ID(void); |
Sissors | 0:ab0aec01b38e | 134 | |
Sissors | 0:ab0aec01b38e | 135 | /** calculate the max number of char in a line |
Sissors | 0:ab0aec01b38e | 136 | * |
Sissors | 0:ab0aec01b38e | 137 | * @returns max columns |
Sissors | 0:ab0aec01b38e | 138 | * depends on actual font size |
Sissors | 0:ab0aec01b38e | 139 | * |
Sissors | 0:ab0aec01b38e | 140 | */ |
Sissors | 0:ab0aec01b38e | 141 | virtual int columns(void); |
Sissors | 0:ab0aec01b38e | 142 | |
Sissors | 0:ab0aec01b38e | 143 | /** calculate the max number of columns |
Sissors | 0:ab0aec01b38e | 144 | * |
Sissors | 0:ab0aec01b38e | 145 | * @returns max column |
Sissors | 0:ab0aec01b38e | 146 | * depends on actual font size |
Sissors | 0:ab0aec01b38e | 147 | * |
Sissors | 0:ab0aec01b38e | 148 | */ |
Sissors | 0:ab0aec01b38e | 149 | virtual int rows(void); |
Sissors | 0:ab0aec01b38e | 150 | |
Sissors | 0:ab0aec01b38e | 151 | /** put a char on the screen |
Sissors | 0:ab0aec01b38e | 152 | * |
Sissors | 0:ab0aec01b38e | 153 | * @param value char to print |
Sissors | 0:ab0aec01b38e | 154 | * @returns printed char |
Sissors | 0:ab0aec01b38e | 155 | * |
Sissors | 0:ab0aec01b38e | 156 | */ |
Sissors | 0:ab0aec01b38e | 157 | virtual int _putc(int value); |
Sissors | 0:ab0aec01b38e | 158 | |
Sissors | 0:ab0aec01b38e | 159 | /** draw a character on given position out of the active font to the TFT |
Sissors | 0:ab0aec01b38e | 160 | * |
Sissors | 0:ab0aec01b38e | 161 | * @param x x-position of char (top left) |
Sissors | 0:ab0aec01b38e | 162 | * @param y y-position |
Sissors | 0:ab0aec01b38e | 163 | * @param c char to print |
Sissors | 0:ab0aec01b38e | 164 | * |
Sissors | 0:ab0aec01b38e | 165 | */ |
Sissors | 0:ab0aec01b38e | 166 | virtual void character(int x, int y, int c); |
Sissors | 0:ab0aec01b38e | 167 | |
Sissors | 0:ab0aec01b38e | 168 | /** paint a bitmap on the TFT |
Sissors | 0:ab0aec01b38e | 169 | * |
Sissors | 0:ab0aec01b38e | 170 | * @param x,y : upper left corner |
Sissors | 0:ab0aec01b38e | 171 | * @param w width of bitmap |
Sissors | 0:ab0aec01b38e | 172 | * @param h high of bitmap |
Sissors | 0:ab0aec01b38e | 173 | * @param *bitmap pointer to the bitmap data |
Sissors | 0:ab0aec01b38e | 174 | * |
Sissors | 0:ab0aec01b38e | 175 | * bitmap format: 16 bit R5 G6 B5 |
Sissors | 0:ab0aec01b38e | 176 | * |
Sissors | 0:ab0aec01b38e | 177 | * use Gimp to create / load , save as BMP, option 16 bit R5 G6 B5 |
Sissors | 0:ab0aec01b38e | 178 | * use winhex to load this file and mark data stating at offset 0x46 to end |
Sissors | 0:ab0aec01b38e | 179 | * use edit -> copy block -> C Source to export C array |
Sissors | 0:ab0aec01b38e | 180 | * paste this array into your program |
Sissors | 0:ab0aec01b38e | 181 | * |
Sissors | 0:ab0aec01b38e | 182 | * define the array as static const unsigned char to put it into flash memory |
Sissors | 0:ab0aec01b38e | 183 | * cast the pointer to (unsigned char *) : |
Sissors | 0:ab0aec01b38e | 184 | * tft.Bitmap(10,40,309,50,(unsigned char *)scala); |
Sissors | 0:ab0aec01b38e | 185 | */ |
Sissors | 0:ab0aec01b38e | 186 | void Bitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h,unsigned char *bitmap); |
Sissors | 0:ab0aec01b38e | 187 | |
Sissors | 0:ab0aec01b38e | 188 | |
Sissors | 0:ab0aec01b38e | 189 | /** paint a 16 bit BMP from local filesytem on the TFT (slow) |
Sissors | 0:ab0aec01b38e | 190 | * |
Sissors | 0:ab0aec01b38e | 191 | * @param x,y : upper left corner |
Sissors | 0:ab0aec01b38e | 192 | * @param *Name_BMP name of the BMP file |
Sissors | 0:ab0aec01b38e | 193 | * @returns 1 if bmp file was found and painted |
Sissors | 0:ab0aec01b38e | 194 | * @returns -1 if bmp file was not found |
Sissors | 0:ab0aec01b38e | 195 | * @returns -2 if bmp file is not 16bit |
Sissors | 0:ab0aec01b38e | 196 | * @returns -3 if bmp file is to big for screen |
Sissors | 0:ab0aec01b38e | 197 | * @returns -4 if buffer malloc go wrong |
Sissors | 0:ab0aec01b38e | 198 | * |
Sissors | 0:ab0aec01b38e | 199 | * bitmap format: 16 bit R5 G6 B5 |
Sissors | 0:ab0aec01b38e | 200 | * |
Sissors | 0:ab0aec01b38e | 201 | * use Gimp to create / load , save as BMP, option 16 bit R5 G6 B5 |
Sissors | 0:ab0aec01b38e | 202 | * copy to internal file system |
Sissors | 0:ab0aec01b38e | 203 | * |
Sissors | 0:ab0aec01b38e | 204 | */ |
Sissors | 0:ab0aec01b38e | 205 | |
Sissors | 0:ab0aec01b38e | 206 | int BMP_16(unsigned int x, unsigned int y, const char *Name_BMP); |
Sissors | 0:ab0aec01b38e | 207 | |
Sissors | 0:ab0aec01b38e | 208 | |
Sissors | 0:ab0aec01b38e | 209 | |
Sissors | 0:ab0aec01b38e | 210 | /** select the font to use |
Sissors | 0:ab0aec01b38e | 211 | * |
Sissors | 0:ab0aec01b38e | 212 | * @param f pointer to font array |
Sissors | 0:ab0aec01b38e | 213 | * |
Sissors | 0:ab0aec01b38e | 214 | * font array can created with GLCD Font Creator from http://www.mikroe.com |
Sissors | 0:ab0aec01b38e | 215 | * you have to add 4 parameter at the beginning of the font array to use: |
Sissors | 0:ab0aec01b38e | 216 | * - the number of byte / char |
Sissors | 0:ab0aec01b38e | 217 | * - the vertial size in pixel |
Sissors | 0:ab0aec01b38e | 218 | * - the horizontal size in pixel |
Sissors | 0:ab0aec01b38e | 219 | * - the number of byte per vertical line |
Sissors | 0:ab0aec01b38e | 220 | * you also have to change the array to char[] |
Sissors | 0:ab0aec01b38e | 221 | * |
Sissors | 0:ab0aec01b38e | 222 | */ |
Sissors | 0:ab0aec01b38e | 223 | void set_font(unsigned char* f); |
Sissors | 0:ab0aec01b38e | 224 | |
Sissors | 0:ab0aec01b38e | 225 | /** Set the orientation of the screen |
Sissors | 0:ab0aec01b38e | 226 | * x,y: 0,0 is always top left |
Sissors | 0:ab0aec01b38e | 227 | * |
Sissors | 0:ab0aec01b38e | 228 | * @param o direction to use the screen (0-3) 90� Steps |
Sissors | 0:ab0aec01b38e | 229 | * |
Sissors | 0:ab0aec01b38e | 230 | */ |
Sissors | 0:ab0aec01b38e | 231 | void set_orientation(unsigned int o); |
Sissors | 0:ab0aec01b38e | 232 | void mod_orientation(void); |
Sissors | 0:ab0aec01b38e | 233 | SPI _spi; |
Sissors | 0:ab0aec01b38e | 234 | DigitalOut _cs; |
Sissors | 0:ab0aec01b38e | 235 | DigitalOut _reset; |
Sissors | 0:ab0aec01b38e | 236 | unsigned char* font; |
Sissors | 0:ab0aec01b38e | 237 | |
Sissors | 0:ab0aec01b38e | 238 | |
Sissors | 0:ab0aec01b38e | 239 | |
Sissors | 0:ab0aec01b38e | 240 | // ------------------ PROTECTED PART ------------------ |
Sissors | 0:ab0aec01b38e | 241 | protected: |
Sissors | 0:ab0aec01b38e | 242 | |
Sissors | 0:ab0aec01b38e | 243 | /** Set draw window region to whole screen |
Sissors | 0:ab0aec01b38e | 244 | * |
Sissors | 0:ab0aec01b38e | 245 | */ |
Sissors | 0:ab0aec01b38e | 246 | void WindowMax (void); |
Sissors | 0:ab0aec01b38e | 247 | |
Sissors | 0:ab0aec01b38e | 248 | |
Sissors | 0:ab0aec01b38e | 249 | /** draw a horizontal line |
Sissors | 0:ab0aec01b38e | 250 | * |
Sissors | 0:ab0aec01b38e | 251 | * @param x0 horizontal start |
Sissors | 0:ab0aec01b38e | 252 | * @param x1 horizontal stop |
Sissors | 0:ab0aec01b38e | 253 | * @param y vertical position |
Sissors | 0:ab0aec01b38e | 254 | * @param color 16 bit color |
Sissors | 0:ab0aec01b38e | 255 | * |
Sissors | 0:ab0aec01b38e | 256 | */ |
Sissors | 0:ab0aec01b38e | 257 | void hline(int x0, int x1, int y, int colour); |
Sissors | 0:ab0aec01b38e | 258 | |
Sissors | 0:ab0aec01b38e | 259 | /** draw a vertical line |
Sissors | 0:ab0aec01b38e | 260 | * |
Sissors | 0:ab0aec01b38e | 261 | * @param x horizontal position |
Sissors | 0:ab0aec01b38e | 262 | * @param y0 vertical start |
Sissors | 0:ab0aec01b38e | 263 | * @param y1 vertical stop |
Sissors | 0:ab0aec01b38e | 264 | * @param color 16 bit color |
Sissors | 0:ab0aec01b38e | 265 | */ |
Sissors | 0:ab0aec01b38e | 266 | void vline(int y0, int y1, int x, int colour); |
Sissors | 0:ab0aec01b38e | 267 | |
Sissors | 0:ab0aec01b38e | 268 | /** Set draw window region |
Sissors | 0:ab0aec01b38e | 269 | * |
Sissors | 0:ab0aec01b38e | 270 | * @param x horizontal position |
Sissors | 0:ab0aec01b38e | 271 | * @param y vertical position |
Sissors | 0:ab0aec01b38e | 272 | * @param w window width in pixel |
Sissors | 0:ab0aec01b38e | 273 | * @param h window height in pixels |
Sissors | 0:ab0aec01b38e | 274 | */ |
Sissors | 0:ab0aec01b38e | 275 | virtual void window(int x, int y, int w, int h); |
Sissors | 0:ab0aec01b38e | 276 | |
Sissors | 0:ab0aec01b38e | 277 | |
Sissors | 0:ab0aec01b38e | 278 | /** Init the ILI9320 controller |
Sissors | 0:ab0aec01b38e | 279 | * |
Sissors | 0:ab0aec01b38e | 280 | */ |
Sissors | 0:ab0aec01b38e | 281 | void tft_reset(); |
Sissors | 0:ab0aec01b38e | 282 | |
Sissors | 0:ab0aec01b38e | 283 | /** Write data to the LCD controller |
Sissors | 0:ab0aec01b38e | 284 | * |
Sissors | 0:ab0aec01b38e | 285 | * @param dat data written to LCD controller |
Sissors | 0:ab0aec01b38e | 286 | * |
Sissors | 0:ab0aec01b38e | 287 | */ |
Sissors | 0:ab0aec01b38e | 288 | void wr_dat(unsigned short value); |
Sissors | 0:ab0aec01b38e | 289 | |
Sissors | 0:ab0aec01b38e | 290 | /** Start data sequence to the LCD controller |
Sissors | 0:ab0aec01b38e | 291 | * |
Sissors | 0:ab0aec01b38e | 292 | */ |
Sissors | 0:ab0aec01b38e | 293 | //void wr_dat_start(); |
Sissors | 0:ab0aec01b38e | 294 | void wr_dat_start(void); |
Sissors | 0:ab0aec01b38e | 295 | |
Sissors | 0:ab0aec01b38e | 296 | /** write data only to the LCD controller |
Sissors | 0:ab0aec01b38e | 297 | * |
Sissors | 0:ab0aec01b38e | 298 | * @param data to be written |
Sissors | 0:ab0aec01b38e | 299 | * * |
Sissors | 0:ab0aec01b38e | 300 | */ |
Sissors | 0:ab0aec01b38e | 301 | void wr_dat_only (unsigned short dat); |
Sissors | 0:ab0aec01b38e | 302 | |
Sissors | 0:ab0aec01b38e | 303 | /** Write a command the LCD controller |
Sissors | 0:ab0aec01b38e | 304 | * |
Sissors | 0:ab0aec01b38e | 305 | * @param cmd: command to be written |
Sissors | 0:ab0aec01b38e | 306 | * |
Sissors | 0:ab0aec01b38e | 307 | */ |
Sissors | 0:ab0aec01b38e | 308 | void wr_cmd(unsigned char value); |
Sissors | 0:ab0aec01b38e | 309 | |
Sissors | 0:ab0aec01b38e | 310 | /** Read data from the LCD controller |
Sissors | 0:ab0aec01b38e | 311 | * |
Sissors | 0:ab0aec01b38e | 312 | * @returns data from LCD controller |
Sissors | 0:ab0aec01b38e | 313 | * |
Sissors | 0:ab0aec01b38e | 314 | */ |
Sissors | 0:ab0aec01b38e | 315 | unsigned short rd_dat(void); |
Sissors | 0:ab0aec01b38e | 316 | |
Sissors | 0:ab0aec01b38e | 317 | /** Write a value to the to a LCD register |
Sissors | 0:ab0aec01b38e | 318 | * |
Sissors | 0:ab0aec01b38e | 319 | * @param reg register to be written |
Sissors | 0:ab0aec01b38e | 320 | * @param val data to be written |
Sissors | 0:ab0aec01b38e | 321 | */ |
Sissors | 0:ab0aec01b38e | 322 | void wr_reg (unsigned char reg, unsigned short val); |
Sissors | 0:ab0aec01b38e | 323 | |
Sissors | 0:ab0aec01b38e | 324 | /** Read a LCD register |
Sissors | 0:ab0aec01b38e | 325 | * |
Sissors | 0:ab0aec01b38e | 326 | * @param reg register to be read |
Sissors | 0:ab0aec01b38e | 327 | * @returns value of the register |
Sissors | 0:ab0aec01b38e | 328 | */ |
Sissors | 0:ab0aec01b38e | 329 | unsigned short rd_reg (unsigned char reg); |
Sissors | 0:ab0aec01b38e | 330 | |
Sissors | 0:ab0aec01b38e | 331 | void SetCursor( unsigned short Xpos, unsigned short Ypos ); |
Sissors | 0:ab0aec01b38e | 332 | |
Sissors | 0:ab0aec01b38e | 333 | unsigned int orientation; |
Sissors | 0:ab0aec01b38e | 334 | unsigned int char_x; |
Sissors | 0:ab0aec01b38e | 335 | unsigned int char_y; |
Sissors | 0:ab0aec01b38e | 336 | |
Sissors | 0:ab0aec01b38e | 337 | }; |
Sissors | 0:ab0aec01b38e | 338 | |
Sissors | 0:ab0aec01b38e | 339 | #endif |