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

Files at this revision

API Documentation at this revision

Comitter:
frankvnk
Date:
Sun Mar 23 20:02:45 2014 +0000
Parent:
15:5059751d2fa2
Child:
17:2975b628064f
Commit message:
Added GetCalibration and SetCalibration

Changed in this revision

Mini-DK.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Mini-DK.lib	Tue Mar 18 19:30:28 2014 +0000
+++ b/Mini-DK.lib	Sun Mar 23 20:02:45 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/frankvnk/code/Mini-DK/#5feb12e3801f
+http://mbed.org/users/frankvnk/code/Mini-DK/#9d05a7e6dc9d
--- a/main.cpp	Tue Mar 18 19:30:28 2014 +0000
+++ b/main.cpp	Sun Mar 23 20:02:45 2014 +0000
@@ -36,6 +36,13 @@
 
 int main()
 {
+    // Structs for storing touchpanel calibration data.
+    // Can be written to external storage (eg : eeprom),
+    // read back on startup and written to the touchpanel.
+    // As a result, the real calibration only needs to be done once.
+    Matrix matrix;
+    Coordinate ScreenSample[3];
+
     unsigned short LCD_id;
     TFT.claim(stdout);        // send stdout to the TFT display
     // Disable stdout buffering, allows us to omit \n with printf.
@@ -147,6 +154,40 @@
     TP.TouchPanel_Calibrate();
     TFT.set_font((unsigned char*) Arial12x12);
     TFT.set_orientation(0);
+
+    TFT.cls();
+    TFT.locate(0,20);
+    // read calibration results
+    TP.GetCalibration(&matrix, &ScreenSample[0]);
+    printf("Read calibration results.\n");
+    printf("matrix.An = %d\n", matrix.An);
+    printf("matrix.Bn = %d\n", matrix.Bn);
+    printf("matrix.Cn = %d\n", matrix.Cn);
+    printf("matrix.Dn = %d\n", matrix.Dn);
+    printf("matrix.En = %d\n", matrix.En);
+    printf("matrix.Fn = %d\n", matrix.Fn);
+    printf("matrix.Di = %d\n", matrix.Divider);
+    for (i=0;i<3;i++)
+        printf("sample x[%d] = %d\nsample y[%d] = %d\n", i, ScreenSample[i].x, i, ScreenSample[i].y);
+    // Write calibration results
+    printf("\nWrite calibration results...\n");
+    TP.SetCalibration(&matrix, &ScreenSample[0]);
+    printf("Done.\nTouch panel to read again.\n");
+    while(TP._tp_irq);
+    // read calibration results
+    TFT.cls();
+    TFT.locate(0,20);
+    printf("Calibration results.\n\n");
+    printf("matrix.An = %d\n", matrix.An);
+    printf("matrix.Bn = %d\n", matrix.Bn);
+    printf("matrix.Cn = %d\n", matrix.Cn);
+    printf("matrix.Dn = %d\n", matrix.Dn);
+    printf("matrix.En = %d\n", matrix.En);
+    printf("matrix.Fn = %d\n", matrix.Fn);
+    printf("matrix.Di = %d\n", matrix.Divider);
+    for (i=0;i<3;i++)
+        printf("sample x[%d] = %d\nsample y[%d] = %d\n", i, ScreenSample[i].x, i, ScreenSample[i].y);
+
     TFT.locate(0,0);
     printf(" X:");
     TFT.locate(70,0);