Shows how to use the display. Draws circles that bounce around on the display.

Dependencies:   DmTftLibrary mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /******************************************************************************
00002  * Includes
00003  *****************************************************************************/
00004 
00005 #include "mbed.h"
00006 
00007 #include "BubbleDemo.h"
00008 
00009 #include "DmTftHX8353C.h"
00010 #include "DmTftS6D0164.h"
00011 #include "DmTftIli9325.h"
00012 #include "DmTftIli9341.h"
00013 #include "DmTftSsd2119.h"
00014 
00015 /******************************************************************************
00016  * Typedefs and defines
00017  *****************************************************************************/
00018 
00019 #define RESET_FLAG  \
00020   do { \
00021     if (abortTest) { \
00022       abortTest = false; \
00023       wait(0.04); \
00024     } \
00025   } while(false)
00026 
00027 
00028 #if 0
00029   /* Displays without adapter */
00030   #define DM_PIN_SPI_MOSI   D11
00031   #define DM_PIN_SPI_MISO   D12
00032   #define DM_PIN_SPI_SCLK   D13
00033   #define DM_PIN_CS_TOUCH   D4
00034   #define DM_PIN_CS_TFT     D10
00035   #define DM_PIN_CS_SDCARD  D8
00036   #define DM_PIN_CS_FLASH   D6
00037 #else
00038   /* Displays with adapter */
00039   #define DM_PIN_SPI_MOSI   A0
00040   #define DM_PIN_SPI_MISO   D9
00041   #define DM_PIN_SPI_SCLK   A1
00042   #define DM_PIN_CS_TOUCH   D8
00043   #define DM_PIN_CS_TFT     A3
00044   #define DM_PIN_CS_SDCARD  D10
00045 #endif
00046 
00047 /******************************************************************************
00048  * Local variables
00049  *****************************************************************************/
00050 
00051 static InterruptIn buttonInterrupt(P2_10);
00052 static DigitalOut led(LED1);
00053 
00054 //DmTftHX8353C tft;  /* DM_TFT18_101 */
00055 //DmTftS6D0164 tft;  /* DM_TFT22_102 */
00056 DmTftIli9325 tft;  /* DM_TFT28_103 and DM_TFT24_104 */
00057 //DmTftIli9341 tft;  /* DM_TFT28_105 */
00058 //DmTftSsd2119 tft;   /* DM_TFT35_107 */
00059 
00060 DigitalInOut csTouch(DM_PIN_CS_TOUCH, PIN_OUTPUT, PullUp, 1);
00061 DigitalInOut csDisplay(DM_PIN_CS_TFT, PIN_OUTPUT, PullUp, 1);
00062 DigitalInOut csSDCard(DM_PIN_CS_SDCARD, PIN_OUTPUT, PullUp, 1);
00063 #ifdef DM_PIN_CS_FLASH
00064   DigitalInOut csFlash(DM_PIN_CS_FLASH, PIN_OUTPUT, PullUp, 1);
00065 #endif
00066 
00067 /******************************************************************************
00068  * Global variables
00069  *****************************************************************************/
00070 
00071 /******************************************************************************
00072  * Main
00073  *****************************************************************************/
00074 
00075 int main (void)
00076 {
00077     tft.init();
00078 
00079     BubbleDemo bubbleDemo(&tft, tft.width(), tft.height());
00080     while (1) {    
00081         bubbleDemo.run(750, 20);
00082     }
00083 }