Modified to work with two displays

Dependents:   touch2 default CANary_9341_test CANary_merge

Fork of SPI_TFT by Peter Drescher

Committer:
TickTock
Date:
Sun Feb 17 16:43:25 2013 +0000
Revision:
9:130716c1a3cd
Parent:
8:a71243b666f9
Child:
10:6693193c1fd6
Added colors

Who changed what in which revision?

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