aitendo T18003T01-V2,TFT1.8,SPI,FRDM-KL25Z

Dependents:   FRDM_SPI18TFT_demo

Fork of ST7735_TFT by Jonne Valola

Committer:
king33jp
Date:
Thu Mar 19 13:34:50 2015 +0000
Revision:
2:047ca9682450
aitendo 1.8"TFT,SPI,ST7735B

Who changed what in which revision?

UserRevisionLine numberNew contents of line
king33jp 2:047ca9682450 1 /* mbed library for 128*160 pixel display TFT based on ST7735 LCD Controller
king33jp 2:047ca9682450 2 * ST7735 specific routines (initialization, window addressing, pixel output)
king33jp 2:047ca9682450 3 * Copyright (c) 2011 Jonne Valola
king33jp 2:047ca9682450 4 *
king33jp 2:047ca9682450 5 * WARNING !! WORK IN PROGRESS !!!
king33jp 2:047ca9682450 6 *
king33jp 2:047ca9682450 7 * Graphics routines and SPI routines derived work used with permission from:
king33jp 2:047ca9682450 8 * mbed library for 240*320 pixel display TFT based on HX8347D LCD Controller
king33jp 2:047ca9682450 9 * Copyright (c) 2011 Peter Drescher - DC2PD
king33jp 2:047ca9682450 10 *
king33jp 2:047ca9682450 11 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
king33jp 2:047ca9682450 12 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
king33jp 2:047ca9682450 13 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
king33jp 2:047ca9682450 14 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
king33jp 2:047ca9682450 15 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
king33jp 2:047ca9682450 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
king33jp 2:047ca9682450 17 * THE SOFTWARE.
king33jp 2:047ca9682450 18 */
king33jp 2:047ca9682450 19
king33jp 2:047ca9682450 20 #ifndef MBED_ST7735B_TFT_H
king33jp 2:047ca9682450 21 #define MBED_ST7735B_TFT_H
king33jp 2:047ca9682450 22
king33jp 2:047ca9682450 23 #include "mbed.h"
king33jp 2:047ca9682450 24 #include "GraphicsDisplay.h"
king33jp 2:047ca9682450 25
king33jp 2:047ca9682450 26 #define RGB(r,g,b) (((r&0xF8)<<8)|((g&0xFC)<<3)|((b&0xF8)>>3)) //5 red | 6 green | 5 blue
king33jp 2:047ca9682450 27
king33jp 2:047ca9682450 28 /*define ST7735 Commands */
king33jp 2:047ca9682450 29
king33jp 2:047ca9682450 30 #define ST7735_NOP 0x0
king33jp 2:047ca9682450 31 #define ST7735_SWRESET 0x01
king33jp 2:047ca9682450 32 #define ST7735_RDDID 0x04
king33jp 2:047ca9682450 33 #define ST7735_RDDST 0x09
king33jp 2:047ca9682450 34
king33jp 2:047ca9682450 35 #define ST7735_SLPIN 0x10
king33jp 2:047ca9682450 36 #define ST7735_SLPOUT 0x11
king33jp 2:047ca9682450 37 #define ST7735_PTLON 0x12
king33jp 2:047ca9682450 38 #define ST7735_NORON 0x13
king33jp 2:047ca9682450 39
king33jp 2:047ca9682450 40 #define ST7735_INVOFF 0x20
king33jp 2:047ca9682450 41 #define ST7735_INVON 0x21
king33jp 2:047ca9682450 42 #define ST7735_DISPOFF 0x28
king33jp 2:047ca9682450 43 #define ST7735_DISPON 0x29
king33jp 2:047ca9682450 44 #define ST7735_CASET 0x2A
king33jp 2:047ca9682450 45 #define ST7735_RASET 0x2B
king33jp 2:047ca9682450 46 #define ST7735_RAMWR 0x2C
king33jp 2:047ca9682450 47 #define ST7735_RAMRD 0x2E
king33jp 2:047ca9682450 48
king33jp 2:047ca9682450 49 #define ST7735_COLMOD 0x3A
king33jp 2:047ca9682450 50 #define ST7735_MADCTL 0x36
king33jp 2:047ca9682450 51
king33jp 2:047ca9682450 52
king33jp 2:047ca9682450 53 #define ST7735_FRMCTR1 0xB1
king33jp 2:047ca9682450 54 #define ST7735_FRMCTR2 0xB2
king33jp 2:047ca9682450 55 #define ST7735_FRMCTR3 0xB3
king33jp 2:047ca9682450 56 #define ST7735_INVCTR 0xB4
king33jp 2:047ca9682450 57 #define ST7735_DISSET5 0xB6
king33jp 2:047ca9682450 58
king33jp 2:047ca9682450 59 #define ST7735_PWCTR1 0xC0
king33jp 2:047ca9682450 60 #define ST7735_PWCTR2 0xC1
king33jp 2:047ca9682450 61 #define ST7735_PWCTR3 0xC2
king33jp 2:047ca9682450 62 #define ST7735_PWCTR4 0xC3
king33jp 2:047ca9682450 63 #define ST7735_PWCTR5 0xC4
king33jp 2:047ca9682450 64 #define ST7735_VMCTR1 0xC5
king33jp 2:047ca9682450 65
king33jp 2:047ca9682450 66 #define ST7735_RDID1 0xDA
king33jp 2:047ca9682450 67 #define ST7735_RDID2 0xDB
king33jp 2:047ca9682450 68 #define ST7735_RDID3 0xDC
king33jp 2:047ca9682450 69 #define ST7735_RDID4 0xDD
king33jp 2:047ca9682450 70
king33jp 2:047ca9682450 71 #define ST7735_PWCTR6 0xFC
king33jp 2:047ca9682450 72
king33jp 2:047ca9682450 73 #define ST7735_GMCTRP1 0xE0
king33jp 2:047ca9682450 74 #define ST7735_GMCTRN1 0xE1
king33jp 2:047ca9682450 75
king33jp 2:047ca9682450 76 /* some RGB color definitions */
king33jp 2:047ca9682450 77 #define Black 0x0000 /* 0, 0, 0 */
king33jp 2:047ca9682450 78 #define Navy 0x000F /* 0, 0, 128 */
king33jp 2:047ca9682450 79 #define DarkGreen 0x03E0 /* 0, 128, 0 */
king33jp 2:047ca9682450 80 #define DarkCyan 0x03EF /* 0, 128, 128 */
king33jp 2:047ca9682450 81 #define Maroon 0x7800 /* 128, 0, 0 */
king33jp 2:047ca9682450 82 #define Purple 0x780F /* 128, 0, 128 */
king33jp 2:047ca9682450 83 #define Olive 0x7BE0 /* 128, 128, 0 */
king33jp 2:047ca9682450 84 #define LightGrey 0xC618 /* 192, 192, 192 */
king33jp 2:047ca9682450 85 #define DarkGrey 0x7BEF /* 128, 128, 128 */
king33jp 2:047ca9682450 86 #define Blue 0x001F /* 0, 0, 255 */
king33jp 2:047ca9682450 87 #define Green 0x07E0 /* 0, 255, 0 */
king33jp 2:047ca9682450 88 #define Cyan 0x07FF /* 0, 255, 255 */
king33jp 2:047ca9682450 89 #define Red 0xF800 /* 255, 0, 0 */
king33jp 2:047ca9682450 90 #define Magenta 0xF81F /* 255, 0, 255 */
king33jp 2:047ca9682450 91 #define Yellow 0xFFE0 /* 255, 255, 0 */
king33jp 2:047ca9682450 92 #define White 0xFFFF /* 255, 255, 255 */
king33jp 2:047ca9682450 93 #define Orange 0xFD20 /* 255, 165, 0 */
king33jp 2:047ca9682450 94 #define GreenYellow 0xAFE5 /* 173, 255, 47 */
king33jp 2:047ca9682450 95
king33jp 2:047ca9682450 96 class ST7735_TFT : public GraphicsDisplay {
king33jp 2:047ca9682450 97 public:
king33jp 2:047ca9682450 98
king33jp 2:047ca9682450 99 /** Create a ST7735_TFT object connected to SPI and three pins. ST7735 requires rs pin to toggle between data/command
king33jp 2:047ca9682450 100 *
king33jp 2:047ca9682450 101 * @param mosi,miso,sclk SPI
king33jp 2:047ca9682450 102 * @param cs pin connected to CS of display (called SS for 'Slave Select' in ST7735 datasheet)
king33jp 2:047ca9682450 103 * @param rs pin connected to RS of display (called D/CX in ST7735 datasheet)
king33jp 2:047ca9682450 104 * @param reset pin connected to RESET of display
king33jp 2:047ca9682450 105 *
king33jp 2:047ca9682450 106 */
king33jp 2:047ca9682450 107 ST7735_TFT(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName rs, PinName reset,const char* name ="TFT");
king33jp 2:047ca9682450 108
king33jp 2:047ca9682450 109 /** Get the width of the screen in pixel
king33jp 2:047ca9682450 110 *
king33jp 2:047ca9682450 111 * @param
king33jp 2:047ca9682450 112 * @returns width of screen in pixel
king33jp 2:047ca9682450 113 *
king33jp 2:047ca9682450 114 */
king33jp 2:047ca9682450 115 virtual int width();
king33jp 2:047ca9682450 116
king33jp 2:047ca9682450 117 /** Get the height of the screen in pixel
king33jp 2:047ca9682450 118 *
king33jp 2:047ca9682450 119 * @returns height of screen in pixel
king33jp 2:047ca9682450 120 *
king33jp 2:047ca9682450 121 */
king33jp 2:047ca9682450 122 virtual int height();
king33jp 2:047ca9682450 123
king33jp 2:047ca9682450 124 /** Draw a pixel at x,y with color
king33jp 2:047ca9682450 125 *
king33jp 2:047ca9682450 126 * @param x horizontal position
king33jp 2:047ca9682450 127 * @param y vertical position
king33jp 2:047ca9682450 128 * @param color 16 bit pixel color
king33jp 2:047ca9682450 129 */
king33jp 2:047ca9682450 130 virtual void pixel(int x, int y, int colour);
king33jp 2:047ca9682450 131
king33jp 2:047ca9682450 132 /** Get colour of pixel at x,y
king33jp 2:047ca9682450 133 *
king33jp 2:047ca9682450 134 * @param x horizontal position
king33jp 2:047ca9682450 135 * @param y vertical position
king33jp 2:047ca9682450 136 */
king33jp 2:047ca9682450 137
king33jp 2:047ca9682450 138 int getpixel(unsigned int x, unsigned int y);
king33jp 2:047ca9682450 139
king33jp 2:047ca9682450 140 /** draw a circle
king33jp 2:047ca9682450 141 *
king33jp 2:047ca9682450 142 * @param x0,y0 center
king33jp 2:047ca9682450 143 * @param r radius
king33jp 2:047ca9682450 144 * @param color 16 bit color *
king33jp 2:047ca9682450 145 *
king33jp 2:047ca9682450 146 */
king33jp 2:047ca9682450 147
king33jp 2:047ca9682450 148 void circle(int x, int y, int r, int colour);
king33jp 2:047ca9682450 149
king33jp 2:047ca9682450 150 /** draw a filled circle
king33jp 2:047ca9682450 151 *
king33jp 2:047ca9682450 152 * @param x0,y0 center
king33jp 2:047ca9682450 153 * @param r radius
king33jp 2:047ca9682450 154 * @param color 16 bit color *
king33jp 2:047ca9682450 155 *
king33jp 2:047ca9682450 156 * use circle with different radius,
king33jp 2:047ca9682450 157 * can miss some pixel
king33jp 2:047ca9682450 158 */
king33jp 2:047ca9682450 159 void fillcircle(int x, int y, int r, int colour);
king33jp 2:047ca9682450 160
king33jp 2:047ca9682450 161 /** draw a filled circle v2
king33jp 2:047ca9682450 162 *
king33jp 2:047ca9682450 163 * @param x0,y0 center
king33jp 2:047ca9682450 164 * @param r radius
king33jp 2:047ca9682450 165 * @param color 16 bit color *
king33jp 2:047ca9682450 166 *
king33jp 2:047ca9682450 167 * use circle with different radius,
king33jp 2:047ca9682450 168 * can miss some pixel
king33jp 2:047ca9682450 169 */
king33jp 2:047ca9682450 170 void fillcircle2(int x0, int y0, int r, int color);
king33jp 2:047ca9682450 171
king33jp 2:047ca9682450 172 /** draw a 1 pixel line
king33jp 2:047ca9682450 173 *
king33jp 2:047ca9682450 174 * @param x0,y0 start point
king33jp 2:047ca9682450 175 * @param x1,y1 stop point
king33jp 2:047ca9682450 176 * @param color 16 bit color
king33jp 2:047ca9682450 177 *
king33jp 2:047ca9682450 178 */
king33jp 2:047ca9682450 179 void line(int x0, int y0, int x1, int y1, int colour);
king33jp 2:047ca9682450 180
king33jp 2:047ca9682450 181 /** draw a rect
king33jp 2:047ca9682450 182 *
king33jp 2:047ca9682450 183 * @param x0,y0 top left corner
king33jp 2:047ca9682450 184 * @param x1,y1 down right corner
king33jp 2:047ca9682450 185 * @param color 16 bit color
king33jp 2:047ca9682450 186 * *
king33jp 2:047ca9682450 187 */
king33jp 2:047ca9682450 188 void rect(int x0, int y0, int x1, int y1, int colour);
king33jp 2:047ca9682450 189
king33jp 2:047ca9682450 190 /** draw a filled rect
king33jp 2:047ca9682450 191 *
king33jp 2:047ca9682450 192 * @param x0,y0 top left corner
king33jp 2:047ca9682450 193 * @param x1,y1 down right corner
king33jp 2:047ca9682450 194 * @param color 16 bit color
king33jp 2:047ca9682450 195 *
king33jp 2:047ca9682450 196 */
king33jp 2:047ca9682450 197 void fillrect(int x0, int y0, int x1, int y1, int colour);
king33jp 2:047ca9682450 198
king33jp 2:047ca9682450 199 /** setup cursor position
king33jp 2:047ca9682450 200 *
king33jp 2:047ca9682450 201 * @param x x-position (top left)
king33jp 2:047ca9682450 202 * @param y y-position
king33jp 2:047ca9682450 203 */
king33jp 2:047ca9682450 204 virtual void locate(int x, int y);
king33jp 2:047ca9682450 205
king33jp 2:047ca9682450 206 /** Fill the screen with _backgroun color
king33jp 2:047ca9682450 207 *
king33jp 2:047ca9682450 208 */
king33jp 2:047ca9682450 209 virtual void cls (void);
king33jp 2:047ca9682450 210
king33jp 2:047ca9682450 211 /** calculate the max number of char in a line
king33jp 2:047ca9682450 212 *
king33jp 2:047ca9682450 213 * @returns max columns
king33jp 2:047ca9682450 214 * depends on actual font size
king33jp 2:047ca9682450 215 *
king33jp 2:047ca9682450 216 */
king33jp 2:047ca9682450 217 virtual int columns(void);
king33jp 2:047ca9682450 218
king33jp 2:047ca9682450 219 /** calculate the max number of columns
king33jp 2:047ca9682450 220 *
king33jp 2:047ca9682450 221 * @returns max column
king33jp 2:047ca9682450 222 * depends on actual font size
king33jp 2:047ca9682450 223 *
king33jp 2:047ca9682450 224 */
king33jp 2:047ca9682450 225 virtual int rows(void);
king33jp 2:047ca9682450 226
king33jp 2:047ca9682450 227 /** put a char on the screen
king33jp 2:047ca9682450 228 *
king33jp 2:047ca9682450 229 * @param value char to print
king33jp 2:047ca9682450 230 * @returns printed char
king33jp 2:047ca9682450 231 *
king33jp 2:047ca9682450 232 */
king33jp 2:047ca9682450 233 virtual int _putc(int value);
king33jp 2:047ca9682450 234
king33jp 2:047ca9682450 235 /** draw a character on given position out of the active font to the TFT
king33jp 2:047ca9682450 236 *
king33jp 2:047ca9682450 237 * @param x x-position of char (top left)
king33jp 2:047ca9682450 238 * @param y y-position
king33jp 2:047ca9682450 239 * @param c char to print
king33jp 2:047ca9682450 240 *
king33jp 2:047ca9682450 241 */
king33jp 2:047ca9682450 242 virtual void character(int x, int y, int c);
king33jp 2:047ca9682450 243
king33jp 2:047ca9682450 244 /** paint a bitmap on the TFT
king33jp 2:047ca9682450 245 *
king33jp 2:047ca9682450 246 * @param x,y : upper left corner
king33jp 2:047ca9682450 247 * @param w width of bitmap
king33jp 2:047ca9682450 248 * @param h high of bitmap
king33jp 2:047ca9682450 249 * @param *bitmap pointer to the bitmap data
king33jp 2:047ca9682450 250 *
king33jp 2:047ca9682450 251 * bitmap format: 16 bit R5 G6 B5
king33jp 2:047ca9682450 252 *
king33jp 2:047ca9682450 253 * use Gimp to create / load , save as BMP, option 16 bit R5 G6 B5
king33jp 2:047ca9682450 254 * use winhex to load this file and mark data stating at offset 0x46 to end
king33jp 2:047ca9682450 255 * use edit -> copy block -> C Source to export C array
king33jp 2:047ca9682450 256 * paste this array into your program
king33jp 2:047ca9682450 257 *
king33jp 2:047ca9682450 258 * define the array as static const unsigned char to put it into flash memory
king33jp 2:047ca9682450 259 * cast the pointer to (unsigned char *) :
king33jp 2:047ca9682450 260 * tft.Bitmap(10,40,309,50,(unsigned char *)scala);
king33jp 2:047ca9682450 261 */
king33jp 2:047ca9682450 262 void Bitmap(unsigned int x, unsigned int y, unsigned int w, unsigned int h,unsigned char *bitmap);
king33jp 2:047ca9682450 263
king33jp 2:047ca9682450 264
king33jp 2:047ca9682450 265 /** paint a 16 bit BMP from local filesytem on the TFT (slow)
king33jp 2:047ca9682450 266 *
king33jp 2:047ca9682450 267 * @param x,y : upper left corner
king33jp 2:047ca9682450 268 * @param *Name_BMP name of the BMP file
king33jp 2:047ca9682450 269 * @returns 1 if bmp file was found and painted
king33jp 2:047ca9682450 270 * @returns -1 if bmp file was found not found
king33jp 2:047ca9682450 271 * @returns -2 if bmp file is not 16bit
king33jp 2:047ca9682450 272 * @returns -3 if bmp file is to big for screen
king33jp 2:047ca9682450 273 * @returns -4 if buffer malloc go wrong
king33jp 2:047ca9682450 274 *
king33jp 2:047ca9682450 275 * bitmap format: 16 bit R5 G6 B5
king33jp 2:047ca9682450 276 *
king33jp 2:047ca9682450 277 * use Gimp to create / load , save as BMP, option 16 bit R5 G6 B5
king33jp 2:047ca9682450 278 * copy to internal file system
king33jp 2:047ca9682450 279 *
king33jp 2:047ca9682450 280 */
king33jp 2:047ca9682450 281
king33jp 2:047ca9682450 282 int BMP_16(unsigned int x, unsigned int y, const char *Name_BMP);
king33jp 2:047ca9682450 283
king33jp 2:047ca9682450 284 /** Read an area from the LCD RAM to MCU RAM
king33jp 2:047ca9682450 285 *
king33jp 2:047ca9682450 286 * @param x,y : upper left corner
king33jp 2:047ca9682450 287 * @param w width of bitmap
king33jp 2:047ca9682450 288 * @param h high of bitmap
king33jp 2:047ca9682450 289 * @param *buffer pointer to the buffer
king33jp 2:047ca9682450 290 */
king33jp 2:047ca9682450 291
king33jp 2:047ca9682450 292 void read_area(unsigned int x, unsigned int y, unsigned int w, unsigned int h,unsigned char *buffer);
king33jp 2:047ca9682450 293
king33jp 2:047ca9682450 294 /** select the font to use
king33jp 2:047ca9682450 295 *
king33jp 2:047ca9682450 296 * @param f pointer to font array
king33jp 2:047ca9682450 297 *
king33jp 2:047ca9682450 298 * font array can created with GLCD Font Creator from http://www.mikroe.com
king33jp 2:047ca9682450 299 * you have to add 4 parameter at the beginning of the font array to use:
king33jp 2:047ca9682450 300 * - the number of byte / char
king33jp 2:047ca9682450 301 * - the vertial size in pixel
king33jp 2:047ca9682450 302 * - the horizontal size in pixel
king33jp 2:047ca9682450 303 * - the number of byte per vertical line
king33jp 2:047ca9682450 304 * you also have to change the array to char[]
king33jp 2:047ca9682450 305 *
king33jp 2:047ca9682450 306 */
king33jp 2:047ca9682450 307 void set_font(unsigned char* f);
king33jp 2:047ca9682450 308
king33jp 2:047ca9682450 309 /** Set the orientation of the screen
king33jp 2:047ca9682450 310 * x,y: 0,0 is always top left
king33jp 2:047ca9682450 311 *
king33jp 2:047ca9682450 312 * @param o direction to use the screen (0-3) 90&#65533; Steps
king33jp 2:047ca9682450 313 *
king33jp 2:047ca9682450 314 */
king33jp 2:047ca9682450 315 void set_orientation(unsigned int o);
king33jp 2:047ca9682450 316
king33jp 2:047ca9682450 317 SPI _spi;
king33jp 2:047ca9682450 318 DigitalOut _cs;
king33jp 2:047ca9682450 319 DigitalOut _rs;
king33jp 2:047ca9682450 320 DigitalOut _reset;
king33jp 2:047ca9682450 321 unsigned char* font;
king33jp 2:047ca9682450 322
king33jp 2:047ca9682450 323 protected:
king33jp 2:047ca9682450 324
king33jp 2:047ca9682450 325 /** draw a horizontal line
king33jp 2:047ca9682450 326 *
king33jp 2:047ca9682450 327 * @param x0 horizontal start
king33jp 2:047ca9682450 328 * @param x1 horizontal stop
king33jp 2:047ca9682450 329 * @param y vertical position
king33jp 2:047ca9682450 330 * @param color 16 bit color
king33jp 2:047ca9682450 331 *
king33jp 2:047ca9682450 332 */
king33jp 2:047ca9682450 333 void hline(int x0, int x1, int y, int colour);
king33jp 2:047ca9682450 334
king33jp 2:047ca9682450 335 /** draw a vertical line
king33jp 2:047ca9682450 336 *
king33jp 2:047ca9682450 337 * @param x horizontal position
king33jp 2:047ca9682450 338 * @param y0 vertical start
king33jp 2:047ca9682450 339 * @param y1 vertical stop
king33jp 2:047ca9682450 340 * @param color 16 bit color
king33jp 2:047ca9682450 341 */
king33jp 2:047ca9682450 342 void vline(int y0, int y1, int x, int colour);
king33jp 2:047ca9682450 343
king33jp 2:047ca9682450 344 /** Set draw window region
king33jp 2:047ca9682450 345 *
king33jp 2:047ca9682450 346 * @param x horizontal position
king33jp 2:047ca9682450 347 * @param y vertical position
king33jp 2:047ca9682450 348 * @param w window width in pixel
king33jp 2:047ca9682450 349 * @param h window height in pixels
king33jp 2:047ca9682450 350 */
king33jp 2:047ca9682450 351 virtual void window (unsigned int x, unsigned int y, unsigned int w, unsigned int h);
king33jp 2:047ca9682450 352
king33jp 2:047ca9682450 353 /** Set draw window region to whole screen
king33jp 2:047ca9682450 354 *
king33jp 2:047ca9682450 355 */
king33jp 2:047ca9682450 356 void WindowMax (void);
king33jp 2:047ca9682450 357
king33jp 2:047ca9682450 358 /** Init the ST7735 controller
king33jp 2:047ca9682450 359 *
king33jp 2:047ca9682450 360 */
king33jp 2:047ca9682450 361 void tft_reset();
king33jp 2:047ca9682450 362
king33jp 2:047ca9682450 363 /** Write data to the LCD controller
king33jp 2:047ca9682450 364 *
king33jp 2:047ca9682450 365 * @param dat data written to LCD controller
king33jp 2:047ca9682450 366 *
king33jp 2:047ca9682450 367 */
king33jp 2:047ca9682450 368 void wr_dat(int value);
king33jp 2:047ca9682450 369
king33jp 2:047ca9682450 370 /** Write a command the LCD controller
king33jp 2:047ca9682450 371 *
king33jp 2:047ca9682450 372 * @param cmd: command to be written
king33jp 2:047ca9682450 373 *
king33jp 2:047ca9682450 374 */
king33jp 2:047ca9682450 375 void wr_cmd(int value);
king33jp 2:047ca9682450 376
king33jp 2:047ca9682450 377 /** Start data sequence to the LCD controller
king33jp 2:047ca9682450 378 *
king33jp 2:047ca9682450 379 */
king33jp 2:047ca9682450 380 void wr_dat_start();
king33jp 2:047ca9682450 381
king33jp 2:047ca9682450 382 /** Stop of data writing to the LCD controller
king33jp 2:047ca9682450 383 *
king33jp 2:047ca9682450 384 */
king33jp 2:047ca9682450 385 void wr_dat_stop();
king33jp 2:047ca9682450 386
king33jp 2:047ca9682450 387 /** write data to the LCD controller
king33jp 2:047ca9682450 388 *
king33jp 2:047ca9682450 389 * @param data to be written
king33jp 2:047ca9682450 390 * *
king33jp 2:047ca9682450 391 */
king33jp 2:047ca9682450 392 void wr_dat_only(unsigned short dat);
king33jp 2:047ca9682450 393
king33jp 2:047ca9682450 394 /** Read data from the LCD controller
king33jp 2:047ca9682450 395 *
king33jp 2:047ca9682450 396 * @returns data from LCD controller
king33jp 2:047ca9682450 397 *
king33jp 2:047ca9682450 398 */
king33jp 2:047ca9682450 399 unsigned short rd_dat(void);
king33jp 2:047ca9682450 400
king33jp 2:047ca9682450 401 /** Write a value to the to a LCD register
king33jp 2:047ca9682450 402 *
king33jp 2:047ca9682450 403 * @param reg register to be written
king33jp 2:047ca9682450 404 * @param val data to be written
king33jp 2:047ca9682450 405 */
king33jp 2:047ca9682450 406 void wr_reg (unsigned char reg, unsigned short val);
king33jp 2:047ca9682450 407
king33jp 2:047ca9682450 408 /** Read a LCD register
king33jp 2:047ca9682450 409 *
king33jp 2:047ca9682450 410 * @param reg register to be read
king33jp 2:047ca9682450 411 * @returns value of the register
king33jp 2:047ca9682450 412 */
king33jp 2:047ca9682450 413 unsigned short rd_reg (unsigned char reg);
king33jp 2:047ca9682450 414
king33jp 2:047ca9682450 415 unsigned int orientation;
king33jp 2:047ca9682450 416 unsigned int char_x;
king33jp 2:047ca9682450 417 unsigned int char_y;
king33jp 2:047ca9682450 418
king33jp 2:047ca9682450 419
king33jp 2:047ca9682450 420 };
king33jp 2:047ca9682450 421
king33jp 2:047ca9682450 422 #endif