Programme for Test ConnectEve from Mikroe Its Ok

Dependencies:   mbed FT800okForConnectEvewithLuminosite

Committer:
schnf30
Date:
Mon Mar 11 19:16:25 2019 +0000
Revision:
4:4c91c9ca07fb
Parent:
3:303f91161be0
Ok

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dreschpe 0:3edc602de5a7 1 /* Demo for mbed Library for FTDI FT800 Enbedded Video Engine "EVE"
dreschpe 0:3edc602de5a7 2 * based on Original Code Sample from FTDI
dreschpe 0:3edc602de5a7 3 * ported to mbed by Peter Drescher, DC2PD 2014
dreschpe 0:3edc602de5a7 4 * Released under the MIT License: http://mbed.org/license/mit */
dreschpe 0:3edc602de5a7 5
dreschpe 0:3edc602de5a7 6 #include "mbed.h"
dreschpe 0:3edc602de5a7 7 #include "FT_Platform.h"
schnf30 3:303f91161be0 8 FT800 TFT(p5,p6,p7,p10,p8,p9); // mosi, miso, sck, ss, int, pd // the FT800 is connected to SPI 11-13
dreschpe 0:3edc602de5a7 9
dreschpe 0:3edc602de5a7 10 /***************************************************************************/
dreschpe 0:3edc602de5a7 11 /* Show a Screen with Text for 5 seconds */
dreschpe 0:3edc602de5a7 12 /* A spinner shows the delay */
dreschpe 0:3edc602de5a7 13 /***************************************************************************/
dreschpe 0:3edc602de5a7 14
dreschpe 1:a7076a14694b 15 ft_void_t Start_Screen(ft_char8_t *str)
dreschpe 0:3edc602de5a7 16 {
dreschpe 1:a7076a14694b 17 TFT.DLstart(); // start a new display command list
dreschpe 1:a7076a14694b 18 TFT.DL(CLEAR_COLOR_RGB(255,255,255)); // set the clear color to white
dreschpe 1:a7076a14694b 19 TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer
dreschpe 1:a7076a14694b 20 TFT.DL(COLOR_RGB(0x80,0x80,0x00)); // set current color
schnf30 3:303f91161be0 21 TFT.Text((TFT.DispWidth/2), TFT.DispHeight/2, 20, OPT_CENTERX, str); // draw Text with font 31
dreschpe 1:a7076a14694b 22 TFT.DL(COLOR_RGB(0xFF,0x00,0x00)); // change current color
dreschpe 1:a7076a14694b 23 TFT.Spinner((TFT.DispWidth/2),TFT.DispHeight/4, 0,0); // draw a animated spinner
dreschpe 1:a7076a14694b 24
dreschpe 1:a7076a14694b 25 TFT.DL(DISPLAY()); // Display the image
dreschpe 1:a7076a14694b 26 TFT.Swap(); // Swap the current display list
dreschpe 1:a7076a14694b 27 TFT.Flush_Co_Buffer(); // Download the command list into fifo
dreschpe 1:a7076a14694b 28
dreschpe 1:a7076a14694b 29 TFT.WaitCmdfifo_empty(); // Wait till coprocessor completes the operation
dreschpe 1:a7076a14694b 30 TFT.Sleep(5000); // Wait 5 s to show
dreschpe 1:a7076a14694b 31 }
dreschpe 0:3edc602de5a7 32
dreschpe 1:a7076a14694b 33 // construct the screen and downloasd it to the LCD
dreschpe 1:a7076a14694b 34 void screen_1(unsigned int r,unsigned int g,unsigned int b)
dreschpe 1:a7076a14694b 35 {
dreschpe 1:a7076a14694b 36 TFT.DLstart(); // start a new display command list
dreschpe 1:a7076a14694b 37 TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer
dreschpe 1:a7076a14694b 38 TFT.DL(COLOR_RGB(0xff,0xff,0xff)); // set current color to white
dreschpe 1:a7076a14694b 39 TFT.DL(TAG(1)); // assign TAG value 1
dreschpe 1:a7076a14694b 40 TFT.FgColor(COLOR_RGB(0xff,0,0)); // forground color red
dreschpe 1:a7076a14694b 41 TFT.Slider(140,81,310,14,0,r,255); // slider for red
dreschpe 1:a7076a14694b 42 TFT.DL(TAG(2)); // assign TAG value 2
dreschpe 1:a7076a14694b 43 TFT.FgColor(COLOR_RGB(0,0xff,0)); // forground color green
dreschpe 1:a7076a14694b 44 TFT.Slider(140,133,310,14,0,g,255); // slider for green
dreschpe 1:a7076a14694b 45 TFT.DL(TAG(3)); // assign TAG value 3
dreschpe 1:a7076a14694b 46 TFT.FgColor(COLOR_RGB(0,0,0xff)); // forground color blue
dreschpe 1:a7076a14694b 47 TFT.Slider(139,185,310,14,0,b,255); // slider for blue
dreschpe 1:a7076a14694b 48 TFT.DL(COLOR_RGB(0xff,0x00,0x00)); // set current color to red
dreschpe 1:a7076a14694b 49 TFT.Text(82,69,30,0,"R"); // text R
dreschpe 1:a7076a14694b 50 TFT.DL(COLOR_RGB(0x00,0xff,0x00)); // set current color to green
dreschpe 1:a7076a14694b 51 TFT.Text(82,120,30,0,"G"); // text G
dreschpe 1:a7076a14694b 52 TFT.DL(COLOR_RGB(0x00,0x00,0xff)); // set current color to blue
dreschpe 1:a7076a14694b 53 TFT.Text(82,174,30,0,"B"); // text B
dreschpe 1:a7076a14694b 54 TFT.DL(SCISSOR_XY(10,10)); // define area starting at 10,10
dreschpe 1:a7076a14694b 55 TFT.DL(SCISSOR_SIZE(50,50)); // size 50,50
dreschpe 1:a7076a14694b 56 TFT.DL(CLEAR_COLOR_RGB(r,g,b)); // set clear color to r,g,b
dreschpe 1:a7076a14694b 57 TFT.DL(CLEAR(1,1,1)); // fill the area
dreschpe 1:a7076a14694b 58 TFT.DL(DISPLAY()); // Display the image
dreschpe 1:a7076a14694b 59 TFT.Swap(); // Swap the current display list
dreschpe 1:a7076a14694b 60 TFT.Flush_Co_Buffer(); // Download the command list into fifo
dreschpe 1:a7076a14694b 61 TFT.WaitCmdfifo_empty(); // Wait till coprocessor completes the operation
dreschpe 1:a7076a14694b 62 }
dreschpe 0:3edc602de5a7 63
dreschpe 1:a7076a14694b 64 int main()
dreschpe 1:a7076a14694b 65 {
dreschpe 1:a7076a14694b 66 unsigned int r = 0,g = 0,b = 0;
dreschpe 1:a7076a14694b 67 ft_uint32_t TrackRegisterVal = 0; // touch track
dreschpe 1:a7076a14694b 68
schnf30 3:303f91161be0 69 Start_Screen("RGB DEMO For EVECONNECT"); // Show start screen
dreschpe 1:a7076a14694b 70 TFT.Calibrate(); // calibrate the touch screen
schnf30 3:303f91161be0 71 TFT. luminosite( 128) ;
schnf30 3:303f91161be0 72
dreschpe 1:a7076a14694b 73 /* Set the tracker for the 3 sliders - define the Area for touching */
dreschpe 1:a7076a14694b 74 TFT.Track(131,63,330,48,1); // slider r
dreschpe 1:a7076a14694b 75 TFT.Track(131,116,333,48,2); // slider g
dreschpe 1:a7076a14694b 76 TFT.Track(131,168,330,48,3); // slider b
dreschpe 1:a7076a14694b 77 TFT.Flush_Co_Buffer(); // Download the commands into fifo
dreschpe 1:a7076a14694b 78 TFT.WaitCmdfifo_empty(); // Wait till coprocessor completes the operation
dreschpe 1:a7076a14694b 79 screen_1(r,g,b); // paint screen
dreschpe 0:3edc602de5a7 80
dreschpe 1:a7076a14694b 81 /* the demo is updating the screen in a endless loop */
dreschpe 1:a7076a14694b 82 while(1) {
dreschpe 1:a7076a14694b 83 ft_uint8_t tagval = 0;
dreschpe 1:a7076a14694b 84 TrackRegisterVal = TFT.Rd32(REG_TRACKER); // check if one of the tree Slider is touched
dreschpe 1:a7076a14694b 85 tagval = TrackRegisterVal & 0xff;
dreschpe 1:a7076a14694b 86 if(0 != tagval) { // touch -> get new rgb value
dreschpe 1:a7076a14694b 87 if(1 == tagval) { // the red slider is touched
dreschpe 1:a7076a14694b 88 r = TrackRegisterVal>>16; // get the new value
dreschpe 1:a7076a14694b 89 r = r *255/65536; // scale it down to 255
dreschpe 1:a7076a14694b 90 } else if(2 == tagval) { // the green slider is touched
dreschpe 1:a7076a14694b 91 g = TrackRegisterVal>>16; // get new slider value
dreschpe 1:a7076a14694b 92 g = g * 255/65536; // scale it down to 255
dreschpe 1:a7076a14694b 93 } else if(3 == tagval) { // the blue slider is touched
dreschpe 1:a7076a14694b 94 b = TrackRegisterVal>>16; // get new slider value
dreschpe 1:a7076a14694b 95 b = b * 255/65536; // scale it down to 255
dreschpe 1:a7076a14694b 96 }
dreschpe 1:a7076a14694b 97 screen_1(r,g,b); // paint new screen
dreschpe 1:a7076a14694b 98 TFT.Sleep(10); // wait 10ms for next check
dreschpe 1:a7076a14694b 99 }
dreschpe 1:a7076a14694b 100
dreschpe 1:a7076a14694b 101 } // end of display loop
dreschpe 0:3edc602de5a7 102 }
dreschpe 0:3edc602de5a7 103
dreschpe 0:3edc602de5a7 104
dreschpe 0:3edc602de5a7 105