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).

Committer:
frankvnk
Date:
Tue Dec 11 08:58:06 2012 +0000
Revision:
0:ee7076d8260a
First version - LCD and touch working - no Ethernet

Who changed what in which revision?

UserRevisionLine numberNew contents of line
frankvnk 0:ee7076d8260a 1
frankvnk 0:ee7076d8260a 2 #ifndef MBED_Touch_H
frankvnk 0:ee7076d8260a 3 #define MBED_Touch_H
frankvnk 0:ee7076d8260a 4
frankvnk 0:ee7076d8260a 5 #include "SPI_TFT.h"
frankvnk 0:ee7076d8260a 6 #include "mbed.h"
frankvnk 0:ee7076d8260a 7
frankvnk 0:ee7076d8260a 8 typedef struct
frankvnk 0:ee7076d8260a 9 {
frankvnk 0:ee7076d8260a 10 int x;
frankvnk 0:ee7076d8260a 11 int y;
frankvnk 0:ee7076d8260a 12 } Coordinate;
frankvnk 0:ee7076d8260a 13
frankvnk 0:ee7076d8260a 14 typedef struct
frankvnk 0:ee7076d8260a 15 {
frankvnk 0:ee7076d8260a 16 int An,
frankvnk 0:ee7076d8260a 17 Bn,
frankvnk 0:ee7076d8260a 18 Cn,
frankvnk 0:ee7076d8260a 19 Dn,
frankvnk 0:ee7076d8260a 20 En,
frankvnk 0:ee7076d8260a 21 Fn,
frankvnk 0:ee7076d8260a 22 Divider ;
frankvnk 0:ee7076d8260a 23 } Matrix;
frankvnk 0:ee7076d8260a 24
frankvnk 0:ee7076d8260a 25 class TouchScreenADS7843 : public SPI_TFT
frankvnk 0:ee7076d8260a 26 {
frankvnk 0:ee7076d8260a 27 public:
frankvnk 0:ee7076d8260a 28 // (To be modified) C code below works on KEIL compiler but NOT on LPCXpresso/mbed
frankvnk 0:ee7076d8260a 29 // extern Coordinate ScreenSample[3];
frankvnk 0:ee7076d8260a 30 // extern Coordinate DisplaySample[3];
frankvnk 0:ee7076d8260a 31 // extern Matrix matrix ;
frankvnk 0:ee7076d8260a 32 // extern Coordinate display ;
frankvnk 0:ee7076d8260a 33
frankvnk 0:ee7076d8260a 34 TouchScreenADS7843(PinName tp_mosi,PinName tp_miso,PinName tp_sclk,PinName tp_cs,PinName tp_irq,PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset,const char* name ="TFT");
frankvnk 0:ee7076d8260a 35
frankvnk 0:ee7076d8260a 36 void TP_Init(void);
frankvnk 0:ee7076d8260a 37 void TP_GetAdXY(int *x,int *y);
frankvnk 0:ee7076d8260a 38 void TP_DrawPoint(unsigned int Xpos,unsigned int Ypos,unsigned int color);
frankvnk 0:ee7076d8260a 39 // Coordinate Read_Ads7846(void);
frankvnk 0:ee7076d8260a 40 unsigned char Read_Ads7846(Coordinate * screenPtr);
frankvnk 0:ee7076d8260a 41 void TouchPanel_Calibrate(Matrix * matrixPtr);
frankvnk 0:ee7076d8260a 42 unsigned char getDisplayPoint(Coordinate * displayPtr,Coordinate * screenPtr,Matrix * matrixPtr );
frankvnk 0:ee7076d8260a 43
frankvnk 0:ee7076d8260a 44 SPI _tp_spi;
frankvnk 0:ee7076d8260a 45 DigitalOut _tp_cs;
frankvnk 0:ee7076d8260a 46 DigitalIn _tp_irq;
frankvnk 0:ee7076d8260a 47
frankvnk 0:ee7076d8260a 48 protected:
frankvnk 0:ee7076d8260a 49
frankvnk 0:ee7076d8260a 50 #define SPI_RD_DELAY 1
frankvnk 0:ee7076d8260a 51 #define CHX 0xd0 // 12 bit mode
frankvnk 0:ee7076d8260a 52 #define CHY 0x90
frankvnk 0:ee7076d8260a 53
frankvnk 0:ee7076d8260a 54 int Read_XY(unsigned char XY);
frankvnk 0:ee7076d8260a 55 void DrawCross(unsigned int Xpos,unsigned int Ypos);
frankvnk 0:ee7076d8260a 56 unsigned char setCalibrationMatrix( Coordinate * displayPtr,Coordinate * screenPtr,Matrix * matrixPtr);
frankvnk 0:ee7076d8260a 57
frankvnk 0:ee7076d8260a 58 };
frankvnk 0:ee7076d8260a 59 #endif