Updated with option to return from BP screen to main screen, resolved screen navigation issues
Dependencies: SDFileSystem TFTLCD_8bit ds3231 program mbed
Fork of poc_dis_5 by
main.cpp
- Committer:
- nikitateggi
- Date:
- 2017-01-30
- Revision:
- 1:8316c23ec6b9
- Parent:
- 0:c47fb0c1bbf6
- Child:
- 2:3b7b71bfc941
File content as of revision 1:8316c23ec6b9:
#include "mbed.h" #include "ili9325.h" #include "lcd_base.h" #include "display_modules.h" #include "touch_modules.h" #include "ecg_dec.h" #include "touch_modules.h" #include "glc.h" #include "sdcard.h" Serial gc(USBTX, USBRX); DigitalIn q1(PTB11); DigitalIn q(PTB8); //Serial ble(PTC4,PTC3); int main(){ unsigned char state; unsigned char state1; unsigned char nstate; unsigned char nstate1; int pid=0; unsigned char flag=0; unsigned char ecg_flag=0; unsigned char glc_flag=0; unsigned int mgdll; DisableTouch(); gc.baud(115200); init_screen(); //initialize lcd screen_main(); // display of main screen state=1; flag=0; nstate=state; EnableTouch(); // enable touch function while(1) { detect_touch(); // detrmine the touch points switch(state) { case 1: state1=touch_main(); // determining the touch for main screen state=0; nstate1=state1; break; case 2: state1=touch_main_1(); // determining the touch for glc screen state=0; nstate1=state1; break; case 3: state1=touch_main_2(); // determining the touch for ecg screen state=0; nstate1=state1; break; case 4: state1=touch_glc(); // determining the touch for bp screen state=0; nstate1=state1; break; case 5: state1=touch_ecg(); // determining the touch for bp screen state=0; nstate1=state1; break; case 6: state1=touch_ret(); // determining the touch for bp screen state=0; nstate1=state1; // gc.printf("state=%d", state); //gc.printf("state1=%d", state1); break; case 7: state1=touch_again(); // determining the touch for bp screen state=0; nstate1=state1; break; case 10 : DisableTouch(); wait_ms(300); EnableTouch(); state=nstate; // gc.printf("%d", nstate); //state=0; break; default : DisableTouch(); wait_ms(300); EnableTouch(); state=nstate; // gc.printf("%d", nstate); break; } switch(state1) { case 0: DisableTouch(); wait_ms(300); state=nstate; EnableTouch(); break; case 1: screen_main(); // glc main screen state1=0; state=1; nstate=state; flag=0; ecg_flag=0; glc_flag=0; break; case 2: screen_main_1(); // glc main screen state1=0; state=2; nstate=state; break; case 3: if (flag==0) { pid=pid+1; screen_main_2(pid); sd_open_GLCfile(pid); sd_close(); sd_open_ECGfile(pid); sd_close(); sd_open_BPfile(pid); sd_close(); flag=1; } else { screen_main_2(pid); } state1=0; state=3; nstate=state; break; case 4: if (glc_flag==1) { screen_again(); //bp main screen state1=0; state=7; nstate=state; } else { screen_glc(); state1=0; state=4; nstate=state; } break; case 5: if (ecg_flag==1) { screen_again(); state1=0; state=7; nstate=state; } else { screen_ecg(); //bp main screen state1=0; state=5; nstate=state; } break; case 7: glc(pid); glc_flag=1; wait(5); // glc_4(mgdll); state1=9; // gc.printf("%d", state); break; case 8: ecg_countdown(); ecg(pid); state1=0; screen_ecg_2(); state=6; nstate=state; ecg_flag=1; // ble.printf("ecg"); break; case 9: screen_glc_2(); state1=0; state=6; nstate=state; break; default : state1=nstate1; break; } } }