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.
Dependencies: mbed TS_STMPE811 GLCD_MCB1700
main.cpp
00001 00002 #include "mbed.h" 00003 #include "TS.h" 00004 #include "GLCD_MCB1700.h" 00005 #define TFT 1 00006 #define TFT_X 320 00007 #define TFT_Y 240 00008 DigitalOut led1(P1_28); 00009 DigitalOut led2(P1_29); 00010 DigitalOut led3(P1_31); 00011 //LPC1768 I2C P0_10 SDA2 P0_11 SCL2 + pull up 3.3k 3.3VCC 00012 InterruptIn event(P0_5);//P0_5 INT_TS 00013 int x,y,z; 00014 void isr_TSF(void) 00015 { 00016 00017 led3 = 1; 00018 00019 TS_Write (TS_INT_STA, 0xFF); 00020 00021 led3 = 0; 00022 } 00023 int main() { 00024 //init GLCD 00025 #ifdef TFT 00026 GLCD_Init(); 00027 GLCD_Clear (White); 00028 GLCD_DisplayString (0, 0, 1, (unsigned char *)"STMPE811"); 00029 00030 #endif 00031 led1=0; 00032 led2=0; 00033 led3=0; 00034 event.mode(PullUp); //PULL-UP 00035 if(TS_Init ()){ 00036 led2=1; 00037 GLCD_DisplayString (0, 0, 1, (unsigned char *)"erreur STMPE811"); 00038 } 00039 wait(1); 00040 event.fall(&isr_TSF); 00041 while(1) { 00042 if(TS_Read (TS_INT_STA, 1)&7){ 00043 led1=1; 00044 ts_XY( &x,&y,&z); 00045 char text[32]; 00046 sprintf(text," "); 00047 GLCD_DisplayString (1, 0, 1, (unsigned char *)text); 00048 sprintf(text,"x:%d y:%d z:%d ", x,y,z); 00049 GLCD_DisplayString (1, 0, 1, (unsigned char *)text); 00050 TS_Write (TS_INT_STA, 0xFF); 00051 led1=0; 00052 } 00053 } 00054 }
Generated on Fri Jul 15 2022 11:05:24 by
1.7.2