Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "TCLcd.h" 00003 00004 #include "touch.h" 00005 00006 #define X0 p18 00007 #define Y0 p17 00008 #define X1 p16 00009 #define Y1 p15 00010 00011 Ticker timer1; // Sample clock. 00012 Ticker timer2; // "keyboard" scan clock. 00013 Touchpad tp(X0,X1,Y0,Y1); 00014 00015 00016 LocalFileSystem local("local"); 00017 00018 TCLcd lcd( p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16 ); // DB10,DB11,DB12,DB13,DB14,DB15,DB16,DB17,wr,rs,cs,reset 00019 00020 //DigitalOut myled(LED1); 00021 DigitalOut myled(P0_22); 00022 00023 void sample(void) 00024 { 00025 tp.tick(); 00026 } 00027 void scan_keyboard(void) 00028 { 00029 if (tp.hotspot()>0) 00030 { 00031 int x = tp.get_hotspot_x(); 00032 int y = tp.get_hotspot_y(); 00033 } 00034 } 00035 int main() { 00036 int i,j; 00037 unsigned char tmp[2]; 00038 // FILE *fp = fopen("/local/out.txt", "r"); 00039 timer1.attach_us(&sample,1000); // Sample every 1 ms. 00040 timer2.attach_us(&scan_keyboard,10000); // Scan the touchpad every 10 ms. 00041 lcd.lcd_Clear(0xffff); 00042 wait(1.0); 00043 i = 5; 00044 j = 5; 00045 #if 0 00046 while(fread( &tmp[0] , 1 , 1 , fp ) != 0) 00047 { 00048 i = lcd.putc(tmp[0]); 00049 } 00050 fclose(fp); 00051 #endif 00052 while(1) { 00053 #if 1 00054 for(j=0;j<240;j++) 00055 { 00056 for(i=0;i<320;i++) 00057 { 00058 lcd.lcd_Pixel(i,j,BLUE); 00059 // wait(0.01); 00060 } 00061 } 00062 for(j=0;j<120;j++) 00063 { 00064 lcd.lcd_Circle(160,120,j,GREEN); 00065 wait(0.01); 00066 } 00067 myled = 1; 00068 // lcd.lcd_Clear(BLUE); 00069 // wait(0.5); 00070 myled = 0; 00071 lcd.lcd_Clear(YELLOW); 00072 wait(0.5); 00073 #endif 00074 } 00075 }
Generated on Wed Jul 13 2022 15:02:52 by
1.7.2