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).
Diff: TouchADS7843/Touch.h
- Revision:
- 0:ee7076d8260a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TouchADS7843/Touch.h Tue Dec 11 08:58:06 2012 +0000 @@ -0,0 +1,59 @@ + +#ifndef MBED_Touch_H +#define MBED_Touch_H + +#include "SPI_TFT.h" +#include "mbed.h" + + typedef struct + { + int x; + int y; + } Coordinate; + + typedef struct + { + int An, + Bn, + Cn, + Dn, + En, + Fn, + Divider ; + } Matrix; + +class TouchScreenADS7843 : public SPI_TFT +{ +public: +// (To be modified) C code below works on KEIL compiler but NOT on LPCXpresso/mbed +// extern Coordinate ScreenSample[3]; +// extern Coordinate DisplaySample[3]; +// extern Matrix matrix ; +// extern Coordinate display ; + + 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"); + + void TP_Init(void); + void TP_GetAdXY(int *x,int *y); + void TP_DrawPoint(unsigned int Xpos,unsigned int Ypos,unsigned int color); +// Coordinate Read_Ads7846(void); + unsigned char Read_Ads7846(Coordinate * screenPtr); + void TouchPanel_Calibrate(Matrix * matrixPtr); + unsigned char getDisplayPoint(Coordinate * displayPtr,Coordinate * screenPtr,Matrix * matrixPtr ); + + SPI _tp_spi; + DigitalOut _tp_cs; + DigitalIn _tp_irq; + +protected: + +#define SPI_RD_DELAY 1 +#define CHX 0xd0 // 12 bit mode +#define CHY 0x90 + + int Read_XY(unsigned char XY); + void DrawCross(unsigned int Xpos,unsigned int Ypos); + unsigned char setCalibrationMatrix( Coordinate * displayPtr,Coordinate * screenPtr,Matrix * matrixPtr); + +}; +#endif