
Programme for Test ConnectEve from Mikroe Its Ok
Dependencies: mbed FT800okForConnectEvewithLuminosite
main.cpp
00001 /* Demo for mbed Library for FTDI FT800 Enbedded Video Engine "EVE" 00002 * based on Original Code Sample from FTDI 00003 * ported to mbed by Peter Drescher, DC2PD 2014 00004 * Released under the MIT License: http://mbed.org/license/mit */ 00005 00006 #include "mbed.h" 00007 #include "FT_Platform.h" 00008 FT800 TFT(p5,p6,p7,p10,p8,p9); // mosi, miso, sck, ss, int, pd // the FT800 is connected to SPI 11-13 00009 00010 /***************************************************************************/ 00011 /* Show a Screen with Text for 5 seconds */ 00012 /* A spinner shows the delay */ 00013 /***************************************************************************/ 00014 00015 ft_void_t Start_Screen(ft_char8_t *str) 00016 { 00017 TFT.DLstart(); // start a new display command list 00018 TFT.DL(CLEAR_COLOR_RGB(255,255,255)); // set the clear color to white 00019 TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer 00020 TFT.DL(COLOR_RGB(0x80,0x80,0x00)); // set current color 00021 TFT.Text((TFT.DispWidth/2), TFT.DispHeight/2, 20, OPT_CENTERX, str); // draw Text with font 31 00022 TFT.DL(COLOR_RGB(0xFF,0x00,0x00)); // change current color 00023 TFT.Spinner((TFT.DispWidth/2),TFT.DispHeight/4, 0,0); // draw a animated spinner 00024 00025 TFT.DL(DISPLAY()); // Display the image 00026 TFT.Swap(); // Swap the current display list 00027 TFT.Flush_Co_Buffer(); // Download the command list into fifo 00028 00029 TFT.WaitCmdfifo_empty(); // Wait till coprocessor completes the operation 00030 TFT.Sleep(5000); // Wait 5 s to show 00031 } 00032 00033 // construct the screen and downloasd it to the LCD 00034 void screen_1(unsigned int r,unsigned int g,unsigned int b) 00035 { 00036 TFT.DLstart(); // start a new display command list 00037 TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer 00038 TFT.DL(COLOR_RGB(0xff,0xff,0xff)); // set current color to white 00039 TFT.DL(TAG(1)); // assign TAG value 1 00040 TFT.FgColor(COLOR_RGB(0xff,0,0)); // forground color red 00041 TFT.Slider(140,81,310,14,0,r,255); // slider for red 00042 TFT.DL(TAG(2)); // assign TAG value 2 00043 TFT.FgColor(COLOR_RGB(0,0xff,0)); // forground color green 00044 TFT.Slider(140,133,310,14,0,g,255); // slider for green 00045 TFT.DL(TAG(3)); // assign TAG value 3 00046 TFT.FgColor(COLOR_RGB(0,0,0xff)); // forground color blue 00047 TFT.Slider(139,185,310,14,0,b,255); // slider for blue 00048 TFT.DL(COLOR_RGB(0xff,0x00,0x00)); // set current color to red 00049 TFT.Text(82,69,30,0,"R"); // text R 00050 TFT.DL(COLOR_RGB(0x00,0xff,0x00)); // set current color to green 00051 TFT.Text(82,120,30,0,"G"); // text G 00052 TFT.DL(COLOR_RGB(0x00,0x00,0xff)); // set current color to blue 00053 TFT.Text(82,174,30,0,"B"); // text B 00054 TFT.DL(SCISSOR_XY(10,10)); // define area starting at 10,10 00055 TFT.DL(SCISSOR_SIZE(50,50)); // size 50,50 00056 TFT.DL(CLEAR_COLOR_RGB(r,g,b)); // set clear color to r,g,b 00057 TFT.DL(CLEAR(1,1,1)); // fill the area 00058 TFT.DL(DISPLAY()); // Display the image 00059 TFT.Swap(); // Swap the current display list 00060 TFT.Flush_Co_Buffer(); // Download the command list into fifo 00061 TFT.WaitCmdfifo_empty(); // Wait till coprocessor completes the operation 00062 } 00063 00064 int main() 00065 { 00066 unsigned int r = 0,g = 0,b = 0; 00067 ft_uint32_t TrackRegisterVal = 0; // touch track 00068 00069 Start_Screen("RGB DEMO For EVECONNECT"); // Show start screen 00070 TFT.Calibrate(); // calibrate the touch screen 00071 TFT. luminosite( 128) ; 00072 00073 /* Set the tracker for the 3 sliders - define the Area for touching */ 00074 TFT.Track(131,63,330,48,1); // slider r 00075 TFT.Track(131,116,333,48,2); // slider g 00076 TFT.Track(131,168,330,48,3); // slider b 00077 TFT.Flush_Co_Buffer(); // Download the commands into fifo 00078 TFT.WaitCmdfifo_empty(); // Wait till coprocessor completes the operation 00079 screen_1(r,g,b); // paint screen 00080 00081 /* the demo is updating the screen in a endless loop */ 00082 while(1) { 00083 ft_uint8_t tagval = 0; 00084 TrackRegisterVal = TFT.Rd32(REG_TRACKER); // check if one of the tree Slider is touched 00085 tagval = TrackRegisterVal & 0xff; 00086 if(0 != tagval) { // touch -> get new rgb value 00087 if(1 == tagval) { // the red slider is touched 00088 r = TrackRegisterVal>>16; // get the new value 00089 r = r *255/65536; // scale it down to 255 00090 } else if(2 == tagval) { // the green slider is touched 00091 g = TrackRegisterVal>>16; // get new slider value 00092 g = g * 255/65536; // scale it down to 255 00093 } else if(3 == tagval) { // the blue slider is touched 00094 b = TrackRegisterVal>>16; // get new slider value 00095 b = b * 255/65536; // scale it down to 255 00096 } 00097 screen_1(r,g,b); // paint new screen 00098 TFT.Sleep(10); // wait 10ms for next check 00099 } 00100 00101 } // end of display loop 00102 } 00103 00104 00105
Generated on Fri Jul 15 2022 03:04:37 by
