Example showing the use of displays from DisplayModule.com with the LPC4088 Experiment Base Board
Dependencies: DmTftLibrary mbed
Fork of dm_bubbles by
main.cpp@4:12d93f360e6c, 2014-10-01 (annotated)
- Committer:
- embeddedartists
- Date:
- Wed Oct 01 11:28:38 2014 +0000
- Revision:
- 4:12d93f360e6c
- Parent:
- 2:43fe0d1d9259
Cleanup
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
displaymodule | 0:70db0a4adfce | 1 | /****************************************************************************** |
displaymodule | 0:70db0a4adfce | 2 | * Includes |
displaymodule | 0:70db0a4adfce | 3 | *****************************************************************************/ |
displaymodule | 0:70db0a4adfce | 4 | |
displaymodule | 0:70db0a4adfce | 5 | #include "mbed.h" |
displaymodule | 0:70db0a4adfce | 6 | |
displaymodule | 0:70db0a4adfce | 7 | #include "BubbleDemo.h" |
displaymodule | 0:70db0a4adfce | 8 | |
displaymodule | 0:70db0a4adfce | 9 | #include "DmTftHX8353C.h" |
displaymodule | 0:70db0a4adfce | 10 | #include "DmTftS6D0164.h" |
displaymodule | 0:70db0a4adfce | 11 | #include "DmTftIli9325.h" |
displaymodule | 0:70db0a4adfce | 12 | #include "DmTftIli9341.h" |
displaymodule | 0:70db0a4adfce | 13 | #include "DmTftSsd2119.h" |
displaymodule | 0:70db0a4adfce | 14 | |
displaymodule | 0:70db0a4adfce | 15 | /****************************************************************************** |
displaymodule | 0:70db0a4adfce | 16 | * Typedefs and defines |
displaymodule | 0:70db0a4adfce | 17 | *****************************************************************************/ |
displaymodule | 0:70db0a4adfce | 18 | |
displaymodule | 0:70db0a4adfce | 19 | #define RESET_FLAG \ |
displaymodule | 0:70db0a4adfce | 20 | do { \ |
displaymodule | 0:70db0a4adfce | 21 | if (abortTest) { \ |
displaymodule | 0:70db0a4adfce | 22 | abortTest = false; \ |
displaymodule | 0:70db0a4adfce | 23 | wait(0.04); \ |
displaymodule | 0:70db0a4adfce | 24 | } \ |
displaymodule | 0:70db0a4adfce | 25 | } while(false) |
displaymodule | 0:70db0a4adfce | 26 | |
displaymodule | 0:70db0a4adfce | 27 | |
displaymodule | 2:43fe0d1d9259 | 28 | #if 0 |
embeddedartists | 4:12d93f360e6c | 29 | /* Displays without adapter (DM_TFT28_105 & DM_TFT35_107) */ |
displaymodule | 1:e286034c8f6a | 30 | #define DM_PIN_CS_TOUCH D4 |
displaymodule | 1:e286034c8f6a | 31 | #define DM_PIN_CS_TFT D10 |
displaymodule | 1:e286034c8f6a | 32 | #define DM_PIN_CS_SDCARD D8 |
displaymodule | 1:e286034c8f6a | 33 | #define DM_PIN_CS_FLASH D6 |
displaymodule | 1:e286034c8f6a | 34 | #else |
embeddedartists | 4:12d93f360e6c | 35 | /* Displays with adapter (all other displays) */ |
embeddedartists | 4:12d93f360e6c | 36 | #define DM_PIN_CS_TFT D4 |
displaymodule | 1:e286034c8f6a | 37 | #define DM_PIN_CS_SDCARD D10 |
displaymodule | 0:70db0a4adfce | 38 | #endif |
displaymodule | 0:70db0a4adfce | 39 | |
displaymodule | 0:70db0a4adfce | 40 | /****************************************************************************** |
displaymodule | 0:70db0a4adfce | 41 | * Local variables |
displaymodule | 0:70db0a4adfce | 42 | *****************************************************************************/ |
displaymodule | 0:70db0a4adfce | 43 | |
displaymodule | 0:70db0a4adfce | 44 | static InterruptIn buttonInterrupt(P2_10); |
displaymodule | 0:70db0a4adfce | 45 | static DigitalOut led(LED1); |
displaymodule | 0:70db0a4adfce | 46 | |
displaymodule | 0:70db0a4adfce | 47 | |
embeddedartists | 4:12d93f360e6c | 48 | //DmTftHX8353C tft(p5, p7, p30, p17, p16); /* DM-TFT18-101 if inserted in the 40-pin J12 contact */ |
embeddedartists | 4:12d93f360e6c | 49 | DmTftHX8353C tft; /* DM-TFT18-101 with adapter in arduino J1 contact */ |
embeddedartists | 4:12d93f360e6c | 50 | //DmTftS6D0164 tft; /* DM_TFT22_102 with adapter in arduino J1 contact */ |
embeddedartists | 4:12d93f360e6c | 51 | //DmTftIli9325 tft; /* DM_TFT28_103 and DM_TFT24_104 with adapter in arduino J1 contact */ |
embeddedartists | 4:12d93f360e6c | 52 | //DmTftIli9341 tft; /* DM_TFT28_105 directly in arduino J1 contact (no adapter) */ |
embeddedartists | 4:12d93f360e6c | 53 | //DmTftSsd2119 tft; /* DM_TFT35_107 directly in arduino J1 contact (no adapter) */ |
embeddedartists | 4:12d93f360e6c | 54 | |
embeddedartists | 4:12d93f360e6c | 55 | #ifdef DM_PIN_CS_TOUCH |
embeddedartists | 4:12d93f360e6c | 56 | DigitalInOut csTouch(DM_PIN_CS_TOUCH, PIN_OUTPUT, PullUp, 1); |
embeddedartists | 4:12d93f360e6c | 57 | #endif |
displaymodule | 0:70db0a4adfce | 58 | DigitalInOut csDisplay(DM_PIN_CS_TFT, PIN_OUTPUT, PullUp, 1); |
displaymodule | 0:70db0a4adfce | 59 | DigitalInOut csSDCard(DM_PIN_CS_SDCARD, PIN_OUTPUT, PullUp, 1); |
displaymodule | 0:70db0a4adfce | 60 | #ifdef DM_PIN_CS_FLASH |
displaymodule | 0:70db0a4adfce | 61 | DigitalInOut csFlash(DM_PIN_CS_FLASH, PIN_OUTPUT, PullUp, 1); |
displaymodule | 1:e286034c8f6a | 62 | #endif |
displaymodule | 0:70db0a4adfce | 63 | |
displaymodule | 0:70db0a4adfce | 64 | /****************************************************************************** |
displaymodule | 0:70db0a4adfce | 65 | * Global variables |
displaymodule | 0:70db0a4adfce | 66 | *****************************************************************************/ |
displaymodule | 0:70db0a4adfce | 67 | |
displaymodule | 0:70db0a4adfce | 68 | /****************************************************************************** |
displaymodule | 0:70db0a4adfce | 69 | * Main |
displaymodule | 0:70db0a4adfce | 70 | *****************************************************************************/ |
displaymodule | 0:70db0a4adfce | 71 | |
embeddedartists | 4:12d93f360e6c | 72 | /* |
embeddedartists | 4:12d93f360e6c | 73 | Hardware Setup: |
embeddedartists | 4:12d93f360e6c | 74 | |
embeddedartists | 4:12d93f360e6c | 75 | - Jumpers JP1..JP6 should be in position 1-2 |
embeddedartists | 4:12d93f360e6c | 76 | - Jumpers in J14 should NOT be inserted |
embeddedartists | 4:12d93f360e6c | 77 | - Jumper J7 should be inserted |
embeddedartists | 4:12d93f360e6c | 78 | - Display in connector J12 (display will be outside of base boards boundaries) |
embeddedartists | 4:12d93f360e6c | 79 | or in arduino socket J1 depending on display |
embeddedartists | 4:12d93f360e6c | 80 | */ |
embeddedartists | 4:12d93f360e6c | 81 | |
embeddedartists | 4:12d93f360e6c | 82 | /* |
embeddedartists | 4:12d93f360e6c | 83 | Test Comments: |
embeddedartists | 4:12d93f360e6c | 84 | |
embeddedartists | 4:12d93f360e6c | 85 | - This example can be used with the DM-TFT18-101 1.8" either in the 40-pin J12 |
embeddedartists | 4:12d93f360e6c | 86 | connector or on top of the DM-ADTAU-001 board in the arduino J1 socket. |
embeddedartists | 4:12d93f360e6c | 87 | - The DM-TFT22-102, DM-TFT28-103 and DM-TFT24-104 must all be used on top |
embeddedartists | 4:12d93f360e6c | 88 | of the DM-ADTAU-001 board in the arduino J1 socket. |
embeddedartists | 4:12d93f360e6c | 89 | - The DM-TFT28-105 and DM-TFT35-107 displays have direct arduino pinning and |
embeddedartists | 4:12d93f360e6c | 90 | can be inserted directly in the J1 socket. |
embeddedartists | 4:12d93f360e6c | 91 | */ |
embeddedartists | 4:12d93f360e6c | 92 | |
displaymodule | 0:70db0a4adfce | 93 | int main (void) |
displaymodule | 0:70db0a4adfce | 94 | { |
displaymodule | 0:70db0a4adfce | 95 | tft.init(); |
displaymodule | 0:70db0a4adfce | 96 | |
displaymodule | 0:70db0a4adfce | 97 | BubbleDemo bubbleDemo(&tft, tft.width(), tft.height()); |
displaymodule | 0:70db0a4adfce | 98 | while (1) { |
displaymodule | 0:70db0a4adfce | 99 | bubbleDemo.run(750, 20); |
displaymodule | 0:70db0a4adfce | 100 | } |
displaymodule | 0:70db0a4adfce | 101 | } |