Changes done in ECG and BT
Dependencies: SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217
Fork of merged_code2_20sept_2017_4th_oct_2017 by
main.cpp
- Committer:
- nikitateggi
- Date:
- 2017-02-10
- Revision:
- 3:9a06c2bed650
- Parent:
- 2:3b7b71bfc941
- Child:
- 4:6bd81bb1790d
File content as of revision 3:9a06c2bed650:
#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 "bp.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; // patient ID unsigned char flag=0; unsigned char ecg_flag=0; unsigned char glc_flag=0; 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; break; case 7: state1=touch_again(); // determining the touch for bp screen state=0; nstate1=state1; break; case 8: state1=touch_bp(); // determining the touch for bp screen state=0; nstate1=state1; break; case 10 : DisableTouch(); wait_ms(300); EnableTouch(); state=nstate; break; default : DisableTouch(); wait_ms(300); EnableTouch(); state=nstate; break; } switch(state1) { case 0: DisableTouch(); wait_ms(300); state=nstate; EnableTouch(); break; case 1: DisableTouch(); screen_main(); // glc main screen state1=0; state=1; nstate=state; flag=0; ecg_flag=0; glc_flag=0; EnableTouch(); break; case 2: DisableTouch(); screen_main_1(); // glc main screen state1=0; state=2; nstate=state; EnableTouch(); break; case 3: DisableTouch(); if (flag==0) { pid=pid+1; screen_main_2(pid); sd_open_GLCfilee(pid); sd_close(); sd_open_ECGfilee(pid); sd_close(); sd_open_BPfile(pid); sd_close(); flag=1; } else { screen_main_2(pid); } state1=0; state=3; nstate=state; EnableTouch(); break; case 4: DisableTouch(); if (glc_flag==1) { screen_again(); //bp main screen state1=0; state=7; nstate=state; } else { screen_glc(); state1=0; state=4; nstate=state; } EnableTouch(); break; case 5: DisableTouch(); if (ecg_flag==1) { screen_again(); state1=0; state=7; nstate=state; } else { screen_ecg(); //bp main screen state1=0; state=5; nstate=state; } EnableTouch(); break; case 6: DisableTouch(); screen_bp(); EnableTouch(); state1=0; state=8; break; case 7: DisableTouch(); glc(pid); glc_flag=1; wait(5); // glc_4(mgdll); state1=0; screen_glc_2(); state=6;; // gc.printf("%d", state); EnableTouch(); break; case 8: DisableTouch(); ecg_countdown(); ecg(pid); state1=0; screen_ecg_2(); state=6; nstate=state; ecg_flag=1; // ble.printf("ecg"); EnableTouch(); break; case 9: DisableTouch(); screen_glc_2(); state1=0; state=6; nstate=state; EnableTouch(); break; case 11: DisableTouch(); screen_bp2(); bp(); state1=0; // wait(1); state=6; nstate=state; EnableTouch(); break; default : state1=nstate1; break; } } }