Test code for the touch display, should output the number 12.
Dependencies: SPI_TFT_ILI9341 TFT_fonts mbed
Fork of TFT_Mikroelectronika_IL9341_sketchpad by
Diff: main.cpp
- Revision:
- 8:3ae0674601ec
- Parent:
- 7:c2bc477a07da
- Child:
- 9:6b60556b4cdf
diff -r c2bc477a07da -r 3ae0674601ec main.cpp --- a/main.cpp Wed Jun 15 09:00:27 2016 +0000 +++ b/main.cpp Wed May 24 13:35:34 2017 +0000 @@ -97,12 +97,10 @@ int main() { pc.baud(115200); - int color=0; - int xpos=0,ypos=0,xp=0,yp=0,sw=0;; pwr=1; wait(0.2); - int i; + LCD_LED = 1; // backlight on TFT.claim(stdout); // send stdout to the TFT display @@ -119,75 +117,5 @@ TFT.set_font((unsigned char*) Arial12x12); TFT.locate(0,0); printf(" 0 Hello Mbed 0"); - TFT.set_orientation(1); - TFT.locate(0,0); - printf(" 1 Hello Mbed 1"); - TFT.set_orientation(2); - TFT.locate(0,0); - printf(" 2 Hello Mbed 2"); - TFT.set_orientation(3); - TFT.locate(0,0); - printf(" 3 Hello Mbed 3"); - TFT.set_orientation(3); - TFT.set_font((unsigned char*) Arial24x23); - TFT.locate(50,100); - TFT.printf("TFT orientation 3"); - TFT.set_orientation(0); - - for(i=0; i<10; i++) { - wait(0.2); // wait one seconds - TFT.locate(50,160); - TFT.printf("count %d",i); - } - TFT.set_orientation(0); - TFT.cls(); - // LCD_LED = 1; - //cornwer markers - //TFT.fillcircle(10,10,5,0xffff); - //TFT.fillcircle(230,10,5,0xffff); - //TFT.fillcircle(230,310,5,0xffff); - //TFT.fillcircle(10,310,5,0xffff); - drawbuttons(); - while(1==1) { - - xpos=readX(); - ypos=readY(); - // top chunk of the screen is the button area // - // 0<y<50 is palette area // - - //pc.printf("xpos=%d\t,\typo=%d",xpos,ypos); - xp=(240*(xpos-5800))/51200; - yp=320-(320*(ypos-3000))/58300; - if(touching==1) pc.printf("\txp=%d\t,\typo=%d\n\r",xp,yp); - if(xp>5 && yp>50 && touching==1) TFT.fillcircle(xp,yp,2,color); - if(yp<50) { // color buttons - sw=(int)xp/50; - switch(sw) { - case 0: - color=0xf800; - break; - case 1: - color=0x07e0; - break; - case 2: - color=0x001f; - break; - case 3: - color=0xffff; - break; - case 4: - color=0x0000; - TFT.cls(); - drawbuttons(); - break; - } - // if(xp<50) color=0xF800; - // if(50<xp && xp<100) color=0x07e0; - // if(xp>100 && xp<150) color=0x001f; - } - - wait(0.1); - - } - -} + + } \ No newline at end of file