![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Changes done in ECG and BT
Dependencies: SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217
Fork of merged_code2_20sept_2017_4th_oct_2017 by
Diff: main.cpp
- Revision:
- 49:3ff80c4bc1be
- Parent:
- 48:f90edb35a20e
- Child:
- 50:b42238e7f46d
--- a/main.cpp Fri Sep 15 07:38:47 2017 +0000 +++ b/main.cpp Fri Sep 15 19:44:48 2017 +0000 @@ -15,6 +15,7 @@ #define BATTERY_TIMER_VALUE 600000 #define SERIAL_BAUD_RATE 115200 #define BATTERY_SCREEN_NO_CHARGE_CONDITION 3 +#define TIMER_ENTER_DEBUG_MODE 10000 Serial gc(USBTX, USBRX); DigitalIn q1(PTB11); @@ -34,7 +35,7 @@ static uint32_t filepid_btpid[2] = {}; Timer timer_bt; // timer for bluetooth Timer timer_battery; // timer for battery - +uint8_t debug_mode=0; int main() @@ -44,7 +45,7 @@ static uint8_t state_touch = 1; uint8_t state_t = 1; // state to transmit to bluetooth uint8_t state_r = 0; // state to receive from bluetooth - + DisableTouch(); @@ -56,7 +57,23 @@ battery_monitor(); // monitor battery at the start only battery_status_display(); // display of main screen timer_battery.start(); + timer_bt.start(); + gc.printf("Press any key to enter into debug mode\n"); + while(timer_bt.read_ms()<TIMER_ENTER_DEBUG_MODE) + { + + if (gc.readable()) + { + debug_mode = 1; + timer_bt.stop(); + timer_bt.reset(); + break; + } + } + + timer_bt.stop(); + timer_bt.reset(); while(1) { battery_status_monitoring(); // to monitior battery status after every 10 min. @@ -138,7 +155,7 @@ EnableTouch(); main_state=1; state_touch=12; - sd_close(); + //sd_close(); timer_bt.stop(); timer_bt.reset(); } @@ -274,7 +291,12 @@ state=0; nstate1=state1; break; - + + case 13: + state1 = touch_debug(); //touch state for debug + //state=0; + nstate1=state1; + break; default : DisableTouch(); wait_ms(300); @@ -294,7 +316,7 @@ static uint8_t ecg_flag=0; // ecg_flag to indicate the ecg test is already done for the same pid static uint8_t glc_flag=0; // glc_flag to indicate the glc test is already done for the same pid uint16_t heart_rate=0; - + uint32_t pid_read = 0; switch(state1) // state for display screens { @@ -311,6 +333,7 @@ clear_filecreated_status(); pid = get_filepid(); battery_status_display(); //Display battery status on LCD + debug_mode = 0; EnableTouch(); break; @@ -427,7 +450,7 @@ EnableTouch(); break; - case 9: + case 9: DisableTouch(); screen_bp2(); // bp main screen bp_countdown(); // countdown for bp @@ -456,8 +479,40 @@ state1=0; state=12; EnableTouch(); - break; - + break; + + case 13 : //display screen for debug + DisableTouch(); + screen_debug(); + state1=0; + state=13; + nstate=state; + EnableTouch(); + break; + + case 14 : + DisableTouch(); //state to delete SD card + delete_sdcard(); + screen_sdcard_delete(); + state1=0; + state= 12; + nstate=state; + EnableTouch(); + break; + + case 15 : + DisableTouch(); + // screen_sdcard_read(); //state to delete SD card + gc.printf("Enter the PID number......!!"); + gc.scanf("%d\n", &pid_read); + gc.printf("%d\n",pid_read); + read_sdcard_file(pid_read); + // screen_sdcard_read(); + state1=0; + state= 12; + nstate=state; + EnableTouch(); + break; default : @@ -566,4 +621,9 @@ battery_monitor(); timer_battery.reset(); } +} + +uint8_t read_debug_status() +{ + return debug_mode; } \ No newline at end of file