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:
3:fb4d62b5ffb3
Parent:
2:d0acbd263ec7
Child:
5:781a72d380a1
--- a/Mini-DK/TouchADS7843/Touch.cpp	Thu Jan 03 10:54:09 2013 +0000
+++ b/Mini-DK/TouchADS7843/Touch.cpp	Thu Jan 03 16:16:24 2013 +0000
@@ -18,8 +18,8 @@
 
 #define THRESHOLD 2
 
-TouchScreenADS7843::TouchScreenADS7843(PinName tp_mosi, PinName tp_miso, PinName tp_sclk, PinName tp_cs, PinName tp_irq)
-        : _tp_spi(tp_mosi, tp_miso, tp_sclk), _tp_cs(tp_cs), _tp_irq(tp_irq)
+TouchScreenADS7843::TouchScreenADS7843(PinName tp_mosi, PinName tp_miso, PinName tp_sclk, PinName tp_cs, PinName tp_irq, SPI_TFT *_LCD)
+        : _tp_spi(tp_mosi, tp_miso, tp_sclk), _tp_cs(tp_cs), _tp_irq(tp_irq), LCD(_LCD)
         {
             DisplaySample[0].x=45;
             DisplaySample[0].y=45;
@@ -73,17 +73,17 @@
 
 void TouchScreenADS7843::TP_DrawPoint(unsigned int Xpos,unsigned int Ypos, unsigned int color)
 {
-/*    LCD->wr_reg(0x03, 0x1030);
+    LCD->wr_reg(0x03, 0x1030);
     LCD->WindowMax();
     LCD->pixel(Xpos,Ypos,color);
     LCD->pixel(Xpos+1,Ypos,color);
     LCD->pixel(Xpos,Ypos+1,color);
-    LCD->pixel(Xpos+1,Ypos+1,color);*/
+    LCD->pixel(Xpos+1,Ypos+1,color);
 }
 
 void TouchScreenADS7843::DrawCross(unsigned int Xpos,unsigned int Ypos)
 {
-/*    LCD->line(Xpos-15,Ypos,Xpos-2,Ypos,White);
+    LCD->line(Xpos-15,Ypos,Xpos-2,Ypos,White);
     LCD->line(Xpos+2,Ypos,Xpos+15,Ypos,White);
     LCD->line(Xpos,Ypos-15,Xpos,Ypos-2,White);
     LCD->line(Xpos,Ypos+2,Xpos,Ypos+15,White);
@@ -98,7 +98,7 @@
     LCD->line(Xpos+15,Ypos+7,Xpos+15,Ypos+15,DarkGrey);
 
     LCD->line(Xpos+7,Ypos-15,Xpos+15,Ypos-15,DarkGrey);
-    LCD->line(Xpos+15,Ypos-15,Xpos+15,Ypos-7,DarkGrey);*/
+    LCD->line(Xpos+15,Ypos-15,Xpos+15,Ypos-7,DarkGrey);
 }
 
 unsigned char TouchScreenADS7843::Read_Ads7846(Coordinate * screenPtr)
@@ -106,6 +106,7 @@
     int m0,m1,m2,TP_X[1],TP_Y[1],temp[3];
     uint8_t count=0;
     int buffer[2][9]={{0},{0}};
+    if (screenPtr == NULL) screenPtr = &screen;
     do
     {
         TP_GetAdXY(TP_X,TP_Y);
@@ -244,18 +245,18 @@
     uint8_t i;
     Coordinate screen_cal;
     setCalibrationMatrix( &DisplaySample[0],&ScreenSample[0],&matrix) ;
-//    LCD->set_font((unsigned char*) Arial12x12);
+    LCD->set_font((unsigned char*) Arial12x12);
     for(i=0;i<3;i++)
     {
-//        LCD->cls();
-//        LCD->locate(10,10);
-//        LCD->printf("Touch crosshair to calibrate");
+        LCD->cls();
+        LCD->locate(10,10);
+        LCD->printf("Touch crosshair to calibrate");
         wait_ms(500);
         DrawCross(DisplaySample[i].x,DisplaySample[i].y);
         do {} while (!Read_Ads7846(&screen_cal));
         ScreenSample[i].x= screen_cal.x;ScreenSample[i].y= screen_cal.y;
     }
     setCalibrationMatrix( &DisplaySample[0],&ScreenSample[0],&matrix) ;
-//    LCD->cls();
+    LCD->cls();
 }