Library to control a Graphics TFT connected to 4-wire SPI - revised for the Raio RA8875 Display Controller.

Dependents:   FRDM_RA8875_mPaint RA8875_Demo RA8875_KeyPadDemo SignalGenerator ... more

Fork of SPI_TFT by Peter Drescher

See Components - RA8875 Based Display

Enhanced touch-screen support - where it previous supported both the Resistive Touch and Capacitive Touch based on the FT5206 Touch Controller, now it also has support for the GSL1680 Touch Controller.

Offline Help Manual (Windows chm)

/media/uploads/WiredHome/ra8875.zip.bin (download, rename to .zip and unzip)

Committer:
dreschpe
Date:
Tue Feb 19 21:49:55 2013 +0000
Revision:
11:9bb71766cafc
Parent:
8:65a4de035c3c
fix warnings

Who changed what in which revision?

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