LPC1768 Mini-DK board with 2.8" SPI TFT and SPI touch

Dependencies:   Mini-DK mbed SDFileSystem

WARNING: filetoflash (SD to CPU flash)

The SPI_TFT library called from Mini-DK.lib contains an option to copy an image from the SD card to the CPU flash memory. This allows you to use an image as background without speed loss when writing other text and graphics.

By default, this option is enabled.

It can be disabled by uncommenting the #define mentioned below in Mini_DK.h:

#define NO_FLASH_BUFFER

Since the flash memory has limited write endurance, DO NOT use this feature when you intend to read multiple images from the SD card (eg: when used as a photo frame).

Revision:
7:ffdd4e75b366
Parent:
6:b547fb6c1095
--- a/Mini-DK/SPI_TFT/SPI_TFT.h	Thu Jan 03 21:24:05 2013 +0000
+++ b/Mini-DK/SPI_TFT/SPI_TFT.h	Fri Jan 04 09:52:16 2013 +0000
@@ -1,4 +1,15 @@
-// mbed library for 240*320 pixel display TFT
+/**************************************************************************************************
+ *****                                                                                        *****
+ *****  Name: SPI_TFT.h                                                                       *****
+ *****  Ver.: 1.0                                                                             *****
+ *****  Date: 04/01/2013                                                                      *****
+ *****  Auth: Frank Vannieuwkerke                                                             *****
+ *****        Erik Olieman                                                                    *****
+ *****  Func: library for 240*320 pixel TFT with ILI9320 LCD Controller                       *****
+ *****                                                                                        *****
+ *****  Rewrite from Peter Drescher code - http://mbed.org/cookbook/SPI-driven-QVGA-TFT       *****
+ *****                                                                                        *****
+ **************************************************************************************************/
 
 #ifndef MBED_SPI_TFT_H
 #define MBED_SPI_TFT_H
@@ -54,26 +65,26 @@
    */
   void wr_reg (unsigned char reg, unsigned short val);
 
-  /** Get the width of the screen in pixel
+  /** Get the width of the screen in pixels
    *
    * @param
-   * @returns width of screen in pixel
+   * @returns width of screen in pixels
    *
    */
   virtual int width();
 
-  /** Get the height of the screen in pixel
+  /** Get the height of the screen in pixels
    *
-   * @returns height of screen in pixel
+   * @returns height of screen in pixels
    *
    */
   virtual int height();
 
   /** Draw a pixel at x,y with color
    *
-   * @param x horizontal position
-   * @param y vertical position
-   * @param color 16 bit pixel color
+   * @param x (horizontal position)
+   * @param y (vertical position)
+   * @param color (16 bit pixel color)
    */
   virtual void pixel(int x, int y,int colour);
 
@@ -134,7 +145,7 @@
    */
   virtual void locate(int x, int y);
 
-  /** Fill the screen with _backgroun color
+  /** Fill the screen with _background color
    *
    */
   virtual void cls (void);
@@ -154,9 +165,9 @@
    */
   virtual int columns(void);
 
-  /** calculate the max number of columns
+  /** calculate the max number of rows
    *
-   * @returns max column
+   * @returns max rows
    * depends on actual font size
    *
    */
@@ -207,8 +218,8 @@
    * @returns 1 if bmp file was found and painted
    * @returns -1 if bmp file was not found
    * @returns -2 if bmp file is not 16bit
-   * @returns -3 if bmp file is to big for screen
-   * @returns -4 if buffer malloc go wrong
+   * @returns -3 if bmp file is too big for screen
+   * @returns -4 if buffer malloc goes wrong
    *
    *   bitmap format: 16 bit R5 G6 B5
    *
@@ -225,12 +236,12 @@
    *
    * @param f pointer to font array
    *
-   *   font array can created with GLCD Font Creator from http://www.mikroe.com
+   *   font array can be created with GLCD Font Creator from http://www.mikroe.com
    *   you have to add 4 parameter at the beginning of the font array to use:
-   *   - the number of byte / char
-   *   - the vertial size in pixel
-   *   - the horizontal size in pixel
-   *   - the number of byte per vertical line
+   *   - the number of bytes / char
+   *   - the vertial size in pixels
+   *   - the horizontal size in pixels
+   *   - the number of bytes per vertical line
    *   you also have to change the array to char[]
    *
    */
@@ -243,7 +254,25 @@
    *
    */
   void set_orientation(unsigned int o);
+
+
+  /** Modify the orientation of the screen
+   *  x,y: 0,0 is always top left
+   *
+   * @param none
+   *
+   * ILI9320 limitation: The orientation can only be used with a window command (registers 0x50..0x53)
+   * 
+   * reg 03h (Entry Mode) : BGR = 1 - ORG = 1 - ID0, ID1 and AM are set according to the orientation variable.
+   * IMPORTANT : when ORG = 1, the GRAM writing direction follows the orientation (ID0, ID1, AM bits)
+   *             AND we need to use the window command (reg 50h..53h) to write to an area on the display
+   *             because we cannot change reg 20h and 21h to set the GRAM address (they both remain at 00h).
+   *             This means that the pixel routine does not work when ORG = 1.
+   *             Routines relying on the pixel routine first need to set reg 03h = 0x1030
+   *             (cls, circle and line do so) AND need to write the data according to the orientation variable.
+   */
   void mod_orientation(void);
+
   BurstSPI _spi;
   DigitalOut _cs;
   unsigned char* font;
@@ -296,7 +325,6 @@
    /** Start data sequence to the LCD controller
    *
    */
-  //void wr_dat_start();
   void wr_dat_start(void);
 
   /** Write a command the LCD controller
@@ -320,6 +348,14 @@
    */
   unsigned short rd_reg (unsigned char reg);
 
+  /** Set the cursor position
+   *
+   * @param x (horizontal position)
+   * @param y (vertical position)
+   *
+   * Can only be used when reg 03h = 0x1030 (see note in mod_orientation).
+   *
+   */
   void SetCursor( unsigned short Xpos, unsigned short Ypos );
 
   unsigned int orientation;