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

Mini-DK/TouchADS7843/Touch.h

Committer:
frankvnk
Date:
2013-01-03
Revision:
2:d0acbd263ec7
Parent:
TouchADS7843/Touch.h@ 0:ee7076d8260a
Child:
3:fb4d62b5ffb3

File content as of revision 2:d0acbd263ec7:


#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:
    Coordinate DisplaySample[3];
    Coordinate ScreenSample[3];
    Matrix matrix;
    Coordinate  display;
    Coordinate  screen;

    TouchScreenADS7843(PinName tp_mosi,PinName tp_miso,PinName tp_sclk,PinName tp_cs,PinName tp_irq);

    void TP_GetAdXY(int *x,int *y);
    void TP_DrawPoint(unsigned int Xpos,unsigned int Ypos,unsigned int color);
    unsigned char Read_Ads7846(Coordinate * screenPtr);
    void TouchPanel_Calibrate(void);
    unsigned char getDisplayPoint(void);

    SPI_TFT    *LCD;
    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