Changes done in ECG and BT
Dependencies: SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217
Fork of merged_code2_20sept_2017_4th_oct_2017 by
display_modules.cpp
- Committer:
- nikitateggi
- Date:
- 2017-07-15
- Revision:
- 31:0f67acfc6236
- Parent:
- 29:7edc76b15e3d
- Child:
- 32:76892fdf5e4c
File content as of revision 31:0f67acfc6236:
#include "mbed.h" #include "display_modules.h" #include "touch_modules.h" #include "rtc.h" //#include "main.h" #include "ILI9341.h" //#include <ILI932x.h> #include "Arial12x12.h" #include "Arial24x23.h" //#include "Terminal6x8.h" //#include "Arial43x48_numb.h" //BusOut dataBus( PTC12, PTC13, PTB10, PTC9, PTD4, PTD5, PTD6, PTD7 ); // 16 pins//POC DISPALY 240*320 pixels //ILI9325_LCD lcd( PTC5, PTB9, PTC0, PTB0, &dataBus, NC, PTE31); /*PinName buspins[8]={PTC12, PTC13, PTB10, PTC9, PTD4, PTD5, PTD6, PTD7 }; ILI932x TFT(BUS_8, buspins, PTC5, PTB9, PTC0, PTB0,PTE31,"SPFD5408_2.4") ; DigitalOut backlight(PTC9) ;*/ PinName buspins[8]={PTD2, PTC13, PTB10, PTC9, PTD4, PTD5, PTD6, PTD7 }; //new_display ili9341 ILI9341 TFT(BUS_8, buspins, PTB0, PTB9, PTC0, PTB8,PTE31,"SPFD5408_2.4") ; DigitalOut backlight(PTC9) ; void init_screen() // initializing the screen { //Configure the display driver TFT.FastWindow(true) ; TFT.background(Black); TFT.foreground(White); wait(0.01) ; TFT.cls(); } void screen_main() //main screen { char buff1[32]; time_t epoch_time; epoch_time=rtc_read(); // read the time from rtc module strftime(buff1, 32, "%d-%m-%Y %H:%M",localtime(&epoch_time)); backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.cls() ; wait(0.1) ; TFT.set_font((unsigned char*) Arial12x12); TFT.foreground(Red); TFT.locate(20,100) ; TFT.printf(buff1); TFT.set_font((unsigned char*) Arial24x23); TFT.foreground(Black); TFT.locate(35,20) ; TFT.printf("SENSESEMI") ; TFT.locate(45,60) ; TFT.printf("Sense POC") ; TFT.background(Olive) ; TFT.fillrect( 60,130,180,200,Olive); TFT.locate(100,140) ; TFT.printf("SYS") ; TFT.locate(65,170) ; TFT.printf("CONFIG") ; TFT.fillrect( 60,230,180,300,Olive); TFT.locate(90,250) ; TFT.printf("TEST") ; TFT.BusEnable(false) ; backlight = 1 ; } void screen_main_2(int32_t pid) // test main screen { char buff2[10]; backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; sprintf(buff2 ,"%d", pid); TFT.fillrect(5,20,250,150,White ); TFT.fillrect(60,130,180,200,White ); TFT.fillrect(60,230,180,320,White ); // changed from 300 to 320 TFT.set_font((unsigned char*) Arial24x23); TFT.foreground(Black); TFT.locate(10,50) ; TFT.printf("PATIENTID") ; TFT.locate(180,50) ; TFT.printf(buff2) ; TFT.background(Orange) ; TFT.foreground(Black); TFT.fillrect( 10,130,100,200,Orange); TFT.locate(40,160) ; TFT.printf("BG") ; TFT.fillrect( 130,130,220,200,Orange); TFT.locate(145,160) ; TFT.printf("ECG") ; TFT.fillrect( 10,215,100,285,Orange); TFT.locate(40,245) ; TFT.printf("BP") ; TFT.fillrect(130,215,220,285,Orange); TFT.locate(130,245) ; TFT.printf("HOME") ; TFT.BusEnable(false) ; backlight = 1 ; } void screen_main_1() // System Configuration main screen { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(GreenYellow) ; TFT.fillrect(5,127,230,320,White ); // wait(0.1) ; TFT.set_font((unsigned char*) Arial24x23); TFT.foreground(Black); TFT.fillrect( 10,130,100,200,GreenYellow); TFT.locate(40,160) ; TFT.printf("BLE") ; TFT.fillrect( 130,130,220,200,GreenYellow); TFT.locate(135,160) ; TFT.printf("ERASE") ; TFT.fillrect( 10,215,100,285,GreenYellow); TFT.locate(30,245) ; TFT.printf("FILE") ; TFT.fillrect(130,215,220,285,GreenYellow); TFT.locate(130,245) ; TFT.printf("HOME") ; TFT.BusEnable(false) ; backlight = 1 ; } void screen_ecg() //ECG screen 1 { backlight = 0 ; TFT.BusEnable(true) ; TFT.fillrect(10,130,100,200,White); TFT.fillrect(130,130,220,200,White); TFT.fillrect(130,215,220,285,White); TFT.fillrect(10,215,100,285,White); TFT.fillrect(60,130,180,200,White); TFT.background(Green) ; TFT.fillrect( 60,130,180,200,Green); TFT.locate(80,150) ; TFT.printf("START") ; TFT.fillrect( 60,230,180,300,Green); TFT.locate(85,250) ; TFT.printf("MAIN") ; TFT.BusEnable(false) ; backlight = 1 ; } void screen_ecg_2(uint16_t heart_rate) // ECG screen 2 { char buf[5]; backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Green) ; sprintf (buf, "%d bpm",heart_rate); TFT.fillrect(5,90,230,150,White); TFT.locate(3,100) ; TFT.printf(" ECG Tst Done ") ; TFT.locate(3,150) ; TFT.printf(" HeartRate ") ; TFT.locate(50,180); // changed from 30 TFT.printf(buf) ; TFT.BusEnable(false) ; backlight = 1 ; } void screen_ecg_lead() // ECG screen for displaying no lead proper lead contact { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Red) ; TFT.fillrect(5,90,230,150,White); TFT.locate(50,100) ; TFT.printf("Re-check") ; TFT.locate(3,130) ; TFT.printf("Lead Connection") ; TFT.BusEnable(false) ; backlight = 1 ; } void screen_ecg_lead_bp_fingerdetect() // ECG screen for displaying no lead proper lead contact { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Red) ; TFT.fillrect(5,90,230,150,White); TFT.locate(20,100) ; TFT.printf("Re-check Leads") ; TFT.locate(50,130) ; TFT.printf("& finger ") ; TFT.locate(45,160) ; TFT.printf("placement") ; TFT.BusEnable(false) ; backlight = 1 ; } void screen_ecg_bp() // added screen dispaly text //14/06 { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(Green) ; TFT.fillrect(10,215,230,290,White); //TFT.fillrect(60,230,180,300,Green); //TFT.locate(100,250) ; TFT.foreground(Black) ; // TFT.printf("RET") ; TFT.fillrect( 10,215,100,285,Green); TFT.locate(30,245) ; TFT.printf("MAIN") ; TFT.fillrect(130,215,220,285,Green); TFT.locate(155,235) ; // changed // points // 13/06 TFT.printf("RE-") ; TFT.locate(145,255) ; TFT.printf("TEST") ; TFT.BusEnable(false) ; backlight = 1 ; } void screen_bp() // BP main screen { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(Green) ; TFT.foreground(Black) ; TFT.fillrect(10,130,100,200,White); TFT.fillrect(130,130,220,200,White); TFT.fillrect(10,215,100,285,White); TFT.fillrect(130,215,220,285,White); TFT.fillrect( 60,130,180,200,Green); TFT.locate(80,150) ; TFT.printf("START") ; TFT.fillrect( 60,230,180,300,Green); TFT.locate(100,250) ; TFT.printf("MAIN") ; TFT.BusEnable(false) ; backlight = 1 ; } void screen_bp1(float SBP, float DBP) // BP screen 2 { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Green) ; char buf[10]; TFT.fillrect(3,130,200,200,White); TFT.fillrect(60,230,180,300,White); TFT.locate(3,100) ; TFT.printf(" BP Tst Done ") ; sprintf (buf, "SBP: %.0f ",SBP); // changed to display 2 digits after decimal point, 2May'17 Changed to Integer TFT.locate(5,140) ; // changed 100 to 150 TFT.printf(buf) ; sprintf (buf, "DBP: %.0f",DBP); // changed to display 2 digits after decimal point, 2May'17, Changed to integer TFT.locate(5,170) ; // CHANGED from 150 to 170 TFT.printf(buf) ; //TFT.fillrect(60,230,180,300,Green); //TFT.locate(85,250) ; /* TFT.foreground(Black) ; // commented //16/06 TFT.background(Green) ; //TFT.printf("RET") ; TFT.fillrect( 10,215,100,285,Green); TFT.locate(30,245) ; TFT.printf("RET") ; TFT.fillrect(130,215,220,285,Green); TFT.locate(155,235) ; // changed // points // 13/06 TFT.printf("RE-") ; TFT.locate(145,255) ; TFT.printf("TEST") ; */ TFT.BusEnable(false) ; backlight = 1 ; } void screen_glc() // glc main screen { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(Green) ; TFT.foreground(Black) ; TFT.fillrect(10,130,100,200,White); TFT.fillrect(130,130,220,200,White); TFT.fillrect(10,215,100,285,White); TFT.fillrect(130,215,220,285,White); // TFT.fillrect( 60,130,180,200,Green); // TFT.locate(80,150) ; // TFT.printf("START") ; TFT.fillrect( 10,130,100,200,Green); TFT.locate(30,160) ; // changed to 30 from 40 TFT.printf("FBS") ; TFT.fillrect( 130,130,220,200,Green); TFT.locate(155,160) ; TFT.printf("PP") ; TFT.fillrect( 10,215,100,285,Green); TFT.locate(20,245) ; TFT.printf("RAN") ; TFT.fillrect(130,215,220,285,Green); TFT.locate(155,245); TFT.printf("MAIN") ; // TFT.fillrect( 60,230,180,300,Green); // TFT.locate(100,250) ; // TFT.printf("RET") ; TFT.BusEnable(false) ; backlight = 1 ; } void screen_bp2() //BP screen 3 { /* lcd.FillRoundRect(3,130,200,200,COLOR_BLACK); lcd.FillRoundRect(60,230,180,300,COLOR_BLACK); lcd.FillRect(5,215,230,290,COLOR_BLACK);*/ } void ecg_countdown() // ECG measurement countdown { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Green) ; char tim1[5]; TFT.fillrect(3,130,200,200,White); TFT.fillrect(60,230,180,300,White); TFT.fillrect(5,215,230,290,White); TFT.locate(25,100) ; TFT.printf("ECG starts in") ; for(int i=5;i>=0;i--) { wait(1); sprintf (tim1, "%d",i); TFT.locate(120,120) ; TFT.printf(tim1) ; } TFT.BusEnable(false) ; backlight = 1 ; } void bp_countdown() // ECG measurement countdown { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Green) ; char tim1[5]; TFT.fillrect(3,130,200,200,White); TFT.fillrect(60,230,180,300,White); TFT.fillrect(1,80,240,290,White); //changed the points// 13/06 TFT.locate(25,100) ; TFT.printf("BP starts in") ; for(int i=5;i>=0;i--) { wait(1); sprintf (tim1, "%d",i); TFT.locate(120,120) ; TFT.printf(tim1) ; } TFT.BusEnable(false) ; backlight = 1 ; } void screen_again() // screen to press 'yes' or 'no' to repeat the test { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Black) ; TFT.fillrect(5,127,230,200,White); TFT.locate(50,130) ; TFT.printf("Take test") ; TFT.locate(75,160) ; TFT.printf("again?") ; TFT.background(Orange) ; TFT.locate(30,245) ; TFT.printf("YES") ; TFT.locate(135,245) ; TFT.printf(" NO ") ; backlight = 1 ; TFT.BusEnable(false) ; } void screen_glc_2() // GLC screen 3 after test { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Black) ; TFT.fillrect(5,127,230,320,White); //TFT.fillrect(60,230,180,300,Green); //TFT.locate(85,250) ; TFT.background(Green); //TFT.printf("RET") ; TFT.fillrect( 10,215,100,285,Green); TFT.locate(30,245) ; TFT.printf("MAIN") ; TFT.fillrect(130,215,220,285,Green); TFT.locate(155,235) ; // changed // points // 13/06 TFT.printf("RE-") ; TFT.locate(140,255) ; // changed from 145 to 140 TFT.printf("TEST") ; backlight = 1 ; TFT.BusEnable(false) ; } void glc_1() // GLC screen { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Magenta ) ; TFT.fillrect(3,130,200,200,White); TFT.fillrect(60,230,180,300,White); TFT.fillrect(5,215,230,290,White); TFT.fillrect( 130,130,220,200,White); TFT.locate(5,130) ; TFT.printf("Blood Glucose") ; TFT.locate(5,160) ; TFT.printf("Insert strip") ; TFT.BusEnable(false) ; backlight = 1 ; } void glc_2() // GLC screen { backlight = 0 ; TFT.BusEnable(true) ; TFT.locate(5,160) ; TFT.printf("Strip Detected") ; TFT.locate(5,190) ; TFT.printf("Insert Blood") ; TFT.BusEnable(false) ; backlight = 1 ; } void glc_3() // GLC screen { backlight = 0 ; TFT.BusEnable(true) ; TFT.locate(5,190) ; TFT.printf("Blood Detected") ; TFT.locate( 5,220) ; TFT.printf("computing") ; TFT.BusEnable(false) ; backlight = 1 ; } void glc_4(uint16_t mgdl) // GLC screen to display blood glucose level on the LCD { char buf[10]; sprintf (buf, " BG %d mg/dl",mgdl); backlight = 0 ; TFT.BusEnable(true) ; TFT.fillrect(5,127,230,320,White); TFT.locate(3,100) ; TFT.printf(" BG Tst Done ") ; TFT.locate(5,130) ; TFT.printf(buf) ; TFT.locate(5,160) ; TFT.printf("(Range 70-120 mg/dl)") ; // added 16/06 TFT.BusEnable(false) ; backlight = 1 ; } void bat_screen_nocharge() { /* lcd.FillRect(10,10,20,40,COLOR_RED); lcd.FillRect(5,127,230,200,COLOR_BLACK); lcd.FillRoundRect(60,230,180,300,COLOR_BLACK); lcd.Print( "Low battery",60,130 ,COLOR_RED,COLOR_BLACK, 0); lcd.Print( "Connect",60,160 ,COLOR_RED,COLOR_BLACK, 0); lcd.Print( "Charger",30,205,COLOR_RED,COLOR_BLACK,0); */ backlight = 0 ; TFT.BusEnable(true) ; TFT.fillrect(10,10,20,40,Red); TFT.fillrect(5,127,230,200,White); TFT.fillrect(60,230,180,300,White); TFT.locate(60,130) ; TFT.printf("Low battery") ; TFT.BusEnable(false) ; backlight = 1 ; } void bat_screen_charge() { // lcd.FillRect(10,10,20,40,COLOR_GREEN); backlight = 0 ; TFT.BusEnable(true) ; TFT.fillrect(10,10,20,40,Green); TFT.BusEnable(false) ; backlight = 1 ; } void screen_ecg_error() { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Red) ; TFT.fillrect(5,90,230,150,White); TFT.locate(50,100) ; TFT.printf("ERROR!") ; TFT.locate(20,130) ; TFT.printf("Take ReTest") ; //TFT.locate(45,160) ; // TFT.printf("") ; TFT.BusEnable(false) ; backlight = 1 ; } void screen_bp_error() { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Red) ; TFT.fillrect(5,90,230,150,White); TFT.locate(50,100) ; TFT.printf("ERROR!") ; TFT.locate(20,130) ; TFT.printf("Take ReTest") ; //TFT.locate(45,160) ; // TFT.printf("") ; TFT.BusEnable(false) ; backlight = 1 ; } void glc_error() { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Red) ; TFT.fillrect(5,90,230,300,White); TFT.locate(50,100) ; TFT.printf("ERROR!") ; TFT.locate(20,130) ; TFT.printf("Take ReTest") ; //TFT.locate(45,160) ; // TFT.printf("") ; TFT.BusEnable(false) ; backlight = 1 ; } void BT_connection() { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Blue) ; TFT.fillrect(5,90,230,300,White); TFT.locate(40,140) ; TFT.printf("Connected") ; TFT.locate(20,170) ; TFT.printf("Sending Files") ; //TFT.locate(45,160) ; // TFT.printf("") ; TFT.BusEnable(false) ; backlight = 1 ; } void BT_no_connection() { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Blue) ; TFT.fillrect(5,90,230,300,White); TFT.locate(80,140) ; TFT.printf("Not") ; TFT.locate(40,160) ; TFT.printf("Connected") ; //TFT.locate(45,160) ; // TFT.printf("") ; TFT.BusEnable(false) ; backlight = 1 ; } void BT_finished() { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White) ; TFT.foreground(Blue) ; TFT.fillrect(5,90,230,300,White); TFT.locate(20,140) ; TFT.printf("Files Tranfer") ; TFT.locate(40,170) ; TFT.printf("Completed") ; //TFT.locate(45,160) ; // TFT.printf("") ; TFT.BusEnable(false) ; backlight = 1 ; } void screen_BT_return() // BT main screen { backlight = 0 ; TFT.BusEnable(true) ; TFT.background(Green) ; TFT.foreground(Black) ; TFT.fillrect(5,90,230,300,White); TFT.fillrect( 60,230,180,300,Green); TFT.locate(80,250) ; TFT.printf("MAIN") ; TFT.BusEnable(false) ; backlight = 1 ; } void screen_patient_info(uint32_t current_test_pid,uint32_t bt_file_sent_pid) { char buf[10]; sprintf (buf, "current pid %d",current_test_pid); backlight = 0 ; TFT.BusEnable(true) ; TFT.background(White); TFT.foreground(Blue); TFT.fillrect(5,90,230,300,White); TFT.locate(20,140) ; TFT.printf(buf) ; sprintf (buf, "Bt pid %d",bt_file_sent_pid); TFT.locate(20,170) ; TFT.printf(buf) ; TFT.background(Green) ; TFT.foreground(Black) ; TFT.fillrect( 60,230,180,300,Green); TFT.locate(80,250) ; TFT.printf("MAIN") ; TFT.BusEnable(false) ; backlight = 1 ; }