Curtis Mattull
/
PANEL_GUI_hello_world
basic functional test of FT810 LCD via SPI
Diff: main.cpp
- Revision:
- 2:a4c01cf97666
- Parent:
- 1:7952d133e78c
- Child:
- 3:f47fe17b34a1
--- a/main.cpp Mon Mar 14 17:07:53 2016 +0000 +++ b/main.cpp Wed Mar 16 12:06:43 2016 +0000 @@ -8,12 +8,13 @@ #include "FT_color.h" #include "stdio.h" + #define SAMAPP_DELAY_BTW_APIS (1000) #define SAMAPP_ENABLE_DELAY() Ft_Gpu_Hal_Sleep(SAMAPP_DELAY_BTW_APIS) #define SAMAPP_ENABLE_DELAY_VALUE(x) Ft_Gpu_Hal_Sleep(x) -#define Nucleo_F303K8 -//#define K22 +//#define Nucleo_F303K8 +#define K20 #ifdef Nucleo_F303K8 @@ -26,15 +27,20 @@ #endif +#ifdef K20 //this is the teensy 3.1/3.2 +FT800 TFT(D11,D12,D13,D10,D9,D8); // the FT800 is connected to SPI 5-7, then we have CS, INT, PD +#endif + //Analog inputs and outputs are normalized AnalogIn Feedback(A0); -AnalogOut Control(A3); +AnalogOut Control(DAC); // global Vars unsigned int r,b,g,PressDown, PressUp, CalVal0, CalVal1, CalVal2, CalVal3, CalVal4 ; double xyz = 10.13; char buffer[50]; +uint8_t cali[24]; // function to convert hue , saturation and value to RGB // see http://en.wikipedia.org/wiki/HSL_and_HSV @@ -107,6 +113,8 @@ TFT.DLstart(); // start a new display command list TFT.DL(CLEAR_COLOR_RGB(255,255,255)); // set the clear color to white TFT.DL(CLEAR(1,1,1)); // clear buffers -> color buffer,stencil buffer, tag buffer + + TFT.DL(COLOR_RGB(0x80,0x80,0x00)); // set current color TFT.Text((TFT.DispWidth/2), TFT.DispHeight/2, 31, OPT_CENTERX, str); // draw Text with font 31 TFT.Text((TFT.DispWidth/2), 350, 31, OPT_CENTERX, "Brew Panel!"); // draw Text with font 31 @@ -129,7 +137,7 @@ TFT.DL(COLOR_RGB(0xff,0xff,0xff)); // set current color to white sprintf(buffer, "%.2f", xyz); TFT.Text(500, 71, 31, 0, buffer); - TFT.Number(500, 120, 31,0, CalVal0); + TFT.Number(500, 120, 31,0, cali[0]); //TFT.Number(545, 135, 31, 0, printf(buffer, "%f", xyz)); TFT.DL(TAG(1)); // assign TAG value 1 @@ -197,12 +205,14 @@ { + unsigned int color = 0,bright = 0; ft_uint32_t TrackRegisterVal = 0; // touch track - + + // Flip Screen 180 degree so viewing angle is better + TFT.MemWrite(REG_ROTATE, 1); + TFT.Rotate(1); - - Start_Screen("5"); // Show start screen @@ -210,9 +220,15 @@ Start_Screen("3"); // Show start screen Start_Screen("2"); // Show start screen Start_Screen("1"); // Show start screen + + //if we have calibration data then write else calibrate + //Read from SD + //if good{ + //TFT.write_calibrate(cali); } + //else TFT.Calibrate(); // calibrate the touch screen - - + TFT.read_calibrate(cali); + //save cal to SD card /* Set the tracker for the dial - define the Area for touching */ @@ -221,6 +237,9 @@ TFT.Flush_Co_Buffer(); // Download the commands into fifo TFT.WaitCmdfifo_empty(); // Wait till coprocessor completes the operation TFT.RegRead(0x8001,CalVal0); // Read Calibration Value + TFT.RegRead(0x8002,CalVal1); // Read Calibration Value + TFT.RegRead(0x8003,CalVal2); // Read Calibration Value + screen_1(color,bright); // paint screen