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:
Thu Jan 03 10:54:09 2013 +0000
Revision:
2:d0acbd263ec7
Child:
3:fb4d62b5ffb3
ONLY FOR TEST

Who changed what in which revision?

UserRevisionLine numberNew contents of line
frankvnk 2:d0acbd263ec7 1 /*
frankvnk 2:d0acbd263ec7 2 Date : 31.12.12
frankvnk 2:d0acbd263ec7 3 Author : Erik Olieman
frankvnk 2:d0acbd263ec7 4 ---------------------
frankvnk 2:d0acbd263ec7 5 Code readability and speed
frankvnk 2:d0acbd263ec7 6 1. created separate structure for mini-DK (base for library)
frankvnk 2:d0acbd263ec7 7 2. Removed wr_dat_only routine (uses 8 bit transfer = slow)
frankvnk 2:d0acbd263ec7 8 Replaced each wr_dat_only with
frankvnk 2:d0acbd263ec7 9 _spi.format(16,3);
frankvnk 2:d0acbd263ec7 10 .....
frankvnk 2:d0acbd263ec7 11 _spi.write(...);
frankvnk 2:d0acbd263ec7 12 .....
frankvnk 2:d0acbd263ec7 13 _spi.format(8,3);
frankvnk 2:d0acbd263ec7 14 3. Creation of Mini-DK.h with all declarations specific to the mini-DK board.
frankvnk 2:d0acbd263ec7 15
frankvnk 2:d0acbd263ec7 16
frankvnk 2:d0acbd263ec7 17 Date : 31.12.12
frankvnk 2:d0acbd263ec7 18 Author : Frank Vannieuwkerke
frankvnk 2:d0acbd263ec7 19 ----------------------------
frankvnk 2:d0acbd263ec7 20 NOTE : Current code contains SPI_TFT *LCD; in Touch.h
frankvnk 2:d0acbd263ec7 21 TouchPanel_Calibrate, TP_DrawPoint and DrawCross in Touch.cpp use LCD->...
frankvnk 2:d0acbd263ec7 22 These are currently commented out since using them locks up the system although
frankvnk 2:d0acbd263ec7 23 the compiler does not show any errors. Current code works but the calibration
frankvnk 2:d0acbd263ec7 24 crosshairs do not show - touching their approximate position still allows you to
frankvnk 2:d0acbd263ec7 25 calibrate and draw (TP.TP_DrawPoint in main.cpp temporarily replaced with TFT.rect).
frankvnk 2:d0acbd263ec7 26
frankvnk 2:d0acbd263ec7 27 ??Other solution : see TODOs below??
frankvnk 2:d0acbd263ec7 28 Possible advantage of this solution :
frankvnk 2:d0acbd263ec7 29 Touch library fully independent of LCD library.
frankvnk 2:d0acbd263ec7 30 Perhaps do Calibration with a printed template when LCD is not used (less accurate).
frankvnk 2:d0acbd263ec7 31 This would only be useful when a touchpanel without LCD is used.
frankvnk 2:d0acbd263ec7 32
frankvnk 2:d0acbd263ec7 33
frankvnk 2:d0acbd263ec7 34 Removed reset pin from SPI_TFT (not needed - pin is connected to main reset).
frankvnk 2:d0acbd263ec7 35
frankvnk 2:d0acbd263ec7 36 Separated SPI_TFT from TouchADS7843
frankvnk 2:d0acbd263ec7 37
frankvnk 2:d0acbd263ec7 38 In main.cpp
frankvnk 2:d0acbd263ec7 39 -----------
frankvnk 2:d0acbd263ec7 40 TODO: before TP.TouchPanel_Calibrate()
frankvnk 2:d0acbd263ec7 41 cls
frankvnk 2:d0acbd263ec7 42 draw 3 crosses with numbers according to DisplaySample in touch.cpp
frankvnk 2:d0acbd263ec7 43 Use following text : Calibration - Touch each crosshair in the numbered sequence.
frankvnk 2:d0acbd263ec7 44 after TP.TouchPanel_Calibrate()
frankvnk 2:d0acbd263ec7 45 cls
frankvnk 2:d0acbd263ec7 46
frankvnk 2:d0acbd263ec7 47 Moved following global touch var declarations (at top of main.cpp) to touch.cpp/.h
frankvnk 2:d0acbd263ec7 48 Matrix matrix;
frankvnk 2:d0acbd263ec7 49 Coordinate display;
frankvnk 2:d0acbd263ec7 50 Coordinate screen;
frankvnk 2:d0acbd263ec7 51 NOTE : i did not create a class with var readback, just used plain C notation.
frankvnk 2:d0acbd263ec7 52 These vars can be accessed from other code through <classname>.<varname>
frankvnk 2:d0acbd263ec7 53 example : TP.display.x
frankvnk 2:d0acbd263ec7 54 Only drawback : Each element of these vars needs to be initialised separately.
frankvnk 2:d0acbd263ec7 55 (initialisation of these vars is not possible with array notation).
frankvnk 2:d0acbd263ec7 56
frankvnk 2:d0acbd263ec7 57 In Touch.cpp/.h
frankvnk 2:d0acbd263ec7 58 ---------------
frankvnk 2:d0acbd263ec7 59 Removed TP_Init - moved TP_init code to constructor.
frankvnk 2:d0acbd263ec7 60
frankvnk 2:d0acbd263ec7 61 TODO : Avoid using TFT_LCD library : remove all references to LCD driving
frankvnk 2:d0acbd263ec7 62 remove Drawpoint and Drawcross
frankvnk 2:d0acbd263ec7 63 remove #include Arial12x12
frankvnk 2:d0acbd263ec7 64
frankvnk 2:d0acbd263ec7 65 Variables in call to TouchPanel_Calibrate, Read_Ads7846, getDisplayPoint are no longer needed.
frankvnk 2:d0acbd263ec7 66 Modified these routines accordingly in touch.cpp/.h (pointers no longer needed)
frankvnk 2:d0acbd263ec7 67 *** TouchPanel_Calibrate and getDisplayPoint already modified.
frankvnk 2:d0acbd263ec7 68
frankvnk 2:d0acbd263ec7 69 TODO: Problem with Read_Ads7846 -> is also called in TouchPanel_Calibrate (Touch.cpp) with other var.
frankvnk 2:d0acbd263ec7 70 Solution : in TouchPanel_Calibrate, change screen_cal to screen_tmp and copy (TP.)screen to this
frankvnk 2:d0acbd263ec7 71 variable. Put screen_tmp back to (TP.)screen after setCalibrationMatrix.
frankvnk 2:d0acbd263ec7 72
frankvnk 2:d0acbd263ec7 73
frankvnk 2:d0acbd263ec7 74
frankvnk 2:d0acbd263ec7 75 General notes
frankvnk 2:d0acbd263ec7 76 -------------
frankvnk 2:d0acbd263ec7 77 lpc1768 SPI port - problem with using SD and TFT simultaneously
frankvnk 2:d0acbd263ec7 78 see note http://mbed.org/comments/cr/83/2654/#c4768
frankvnk 2:d0acbd263ec7 79 google search : lpc1768 ssp ssp0 ssp1
frankvnk 2:d0acbd263ec7 80 perhaps use softspi (eg http://arduino.cc/forum/index.php?topic=117356.0)
frankvnk 2:d0acbd263ec7 81 Ignore above notes - use Erik Olieman's solution.
frankvnk 2:d0acbd263ec7 82 */