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: display_modules.cpp
- Revision:
- 7:11f926351d8f
- Parent:
- 6:5e33a0f01476
- Child:
- 9:d0ecb61d219e
--- a/display_modules.cpp Sat Apr 01 06:37:02 2017 +0000 +++ b/display_modules.cpp Wed Apr 26 10:14:53 2017 +0000 @@ -1,39 +1,64 @@ #include "mbed.h" -#include "ili9325.h" -#include "lcd_base.h" #include "display_modules.h" #include "touch_modules.h" #include "rtc.h" //#include "main.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); +//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) ; void init_screen() // initializing the screen { - lcd.Initialize(PORTRAIT); + //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; - lcd.ClearScreen(); - lcd.SetFont(&TerminusFont); - epoch_time=rtc_read(); // read the time from rtc module - // sprintf(buff1 ,"%s", ctime(&epoch_time)); // display time on LCD - strftime(buff1, 32, "%d/%m/%Y %H:%M",localtime(&epoch_time)); - lcd.Print( buff1,20,100,COLOR_YELLOW,COLOR_BLACK, 0); - lcd.SetFont(&TerminusBigFont); - lcd.Print( "SENSESEMI",50,20,COLOR_WHITE,COLOR_BLACK, 0); - lcd.Print( "SenseSmart",45,60,COLOR_WHITE,COLOR_BLACK, 0);// align text to center horizontally and use starndard colors - lcd.FillRoundRect(60,130,180,200,COLOR_YELLOW); - lcd.Print( "SYS",100,140,COLOR_BLACK,COLOR_YELLOW,0); - lcd.Print( "CONFIG",70,170,COLOR_BLACK,COLOR_YELLOW,0); - lcd.FillRoundRect(60,230,180,300,COLOR_GREEN); - lcd.Print( "TEST",90,250,COLOR_BLACK,COLOR_GREEN,0); + 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("SenseSmart") ; + 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 ; } @@ -41,62 +66,89 @@ void screen_main_2(int pid) // test main screen { - - char buff2[10]; - - lcd.FillRect(5,20,250,150,COLOR_BLACK); - //lcd.Print( "SenseSmart", CENTER, 95); - sprintf(buff2 ,"%d", pid); - lcd.Print( "PATIENTID",20,50,COLOR_YELLOW,COLOR_BLACK, 0); ///////// - lcd.Print(buff2,170,50,COLOR_YELLOW,COLOR_BLACK, 0); - - lcd.SetFont(&TerminusBigFont); - // lcd.FillRect(5,120,230,320,COLOR_BLACK); - lcd.FillRoundRect(60,130,180,200,COLOR_BLACK); - lcd.FillRoundRect(60,230,180,300,COLOR_BLACK); - lcd.FillRoundRect(10,130,100,200,COLOR_CYAN); - lcd.Print( "BG",40,160,COLOR_BLACK,COLOR_CYAN,0); - lcd.FillRoundRect(130,130,220,200,COLOR_YELLOW); - lcd.Print( "ECG",160,160,COLOR_BLACK,COLOR_YELLOW,0); - lcd.FillRoundRect(10,215,100,285,COLOR_MAGENTA); - lcd.Print( "BP",40,245,COLOR_BLACK,COLOR_MAGENTA,0); - lcd.FillRoundRect(130,215,220,285,COLOR_GREEN); - lcd.Print( "HOME",150,245,COLOR_BLACK,COLOR_GREEN,0); - - } + 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,300,White ); + 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 { - - lcd.SetFont(&TerminusBigFont); - lcd.FillRect(5,127,230,320,COLOR_BLACK); - lcd.FillRoundRect(10,130,100,200,COLOR_CYAN); - lcd.Print( "BLE",30,160,COLOR_BLACK,COLOR_CYAN,0); - lcd.FillRoundRect(130,130,220,200,COLOR_YELLOW); - lcd.Print( "ERASE",140,160,COLOR_BLACK,COLOR_YELLOW,0); - lcd.FillRoundRect(10,215,100,285,COLOR_MAGENTA); - lcd.Print( "FILE",20,245,COLOR_BLACK,COLOR_MAGENTA,0); - lcd.FillRoundRect(130,215,220,285,COLOR_GREEN); - lcd.Print( "HOME",145,245,COLOR_BLACK,COLOR_GREEN,0); - - } + 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 { - - // lcd.FillRect(5,127,230,320,COLOR_BLACK); - lcd.FillRoundRect(10,130,100,200,COLOR_BLACK); - lcd.FillRoundRect(130,130,220,200,COLOR_BLACK); - lcd.FillRoundRect(10,215,100,285,COLOR_BLACK); - lcd.FillRoundRect(130,215,220,285,COLOR_BLACK); - lcd.FillRoundRect(60,130,180,200,COLOR_YELLOW); - lcd.Print( "START",80,150,COLOR_BLACK,COLOR_YELLOW,0); - // lcd.Print( "CONFIG",70,170,COLOR_BLACK,COLOR_YELLOW,0); - lcd.FillRoundRect(60,230,180,300,COLOR_GREEN); - lcd.Print( "RET",100,250,COLOR_BLACK,COLOR_GREEN,0); + 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("RET") ; + TFT.BusEnable(false) ; + backlight = 1 ; + + + } @@ -104,18 +156,26 @@ void screen_ecg_2() // ECG screen 2 { - - lcd.FillRect(5,90,230,150,COLOR_BLACK); - lcd.Print( " Tst is Done ",3,100,COLOR_GREEN,COLOR_BLACK,0); - lcd.Print( " HeartRate ",3,150,COLOR_GREEN,COLOR_BLACK,0); - lcd.Print( " 72 bpm",3,180,COLOR_CYAN,COLOR_BLACK,0); - // lcd.Print( "DONE", CENTER, 95); - // lcd.Print( "s Done ",80,150,COLOR_GREEN,COLOR_BLACK,0); - lcd.FillRect(10,215,230,290,COLOR_BLACK); - // lcd.FillRoundRect(10,215,100,285,COLOR_MAGENTA); - // lcd.FillRoundRect(130,215,220,285,COLOR_GREEN); - lcd.FillRoundRect(60,230,180,300,COLOR_GREEN); - lcd.Print( "RET",100,250,COLOR_BLACK,COLOR_GREEN,0); + backlight = 0 ; + TFT.BusEnable(true) ; + TFT.background(White) ; + TFT.foreground(Green) ; + + TFT.fillrect(5,90,230,150,White); + TFT.locate(3,100) ; + TFT.printf(" Tst is Done ") ; + TFT.locate(3,150) ; + TFT.printf(" HeartRate ") ; + TFT.locate(3,180); + TFT.printf(" 72 bpm") ; + 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.BusEnable(false) ; + backlight = 1 ; } @@ -123,31 +183,47 @@ void screen_bp() // BP main screen { - lcd.FillRoundRect(10,130,100,200,COLOR_BLACK); - lcd.FillRoundRect(130,130,220,200,COLOR_BLACK); - lcd.FillRoundRect(10,215,100,285,COLOR_BLACK); - lcd.FillRoundRect(130,215,220,285,COLOR_BLACK); - lcd.FillRoundRect(60,130,180,200,COLOR_YELLOW); - lcd.Print( "START",80,150,COLOR_BLACK,COLOR_YELLOW,0); - // lcd.Print( "CONFIG",70,170,COLOR_BLACK,COLOR_YELLOW,0); - lcd.FillRoundRect(60,230,180,300,COLOR_GREEN); - lcd.Print( "RET",100,250,COLOR_BLACK,COLOR_GREEN,0); + 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("RET") ; + TFT.BusEnable(false) ; + backlight = 1 ; } void screen_bp1(float SBP, float DBP) // BP screen 2 { - - char buf[10]; - lcd.FillRoundRect(3,130,200,200,COLOR_BLACK); - lcd.FillRoundRect(60,230,180,300,COLOR_BLACK); + backlight = 0 ; + TFT.BusEnable(true) ; + TFT.background(White) ; + TFT.foreground(Green) ; + char buf[10]; + TFT.fillrect(3,130,200,200,Black); + TFT.fillrect(60,230,180,300,Black); sprintf (buf, "SBP: %f",SBP); - lcd.Print( buf, 5,100,COLOR_CYAN,COLOR_BLACK, 0); - sprintf (buf, "DBP: %f",DBP); - lcd.Print( buf, 5,150,COLOR_CYAN,COLOR_BLACK, 0); - lcd.FillRoundRect(60,230,180,300,COLOR_GREEN); - lcd.Print( "RET",100,250,COLOR_BLACK,COLOR_GREEN,0); + TFT.locate(5,100) ; + TFT.printf(buf) ; + sprintf (buf, "DBP: %f",DBP); + TFT.locate(5,150) ; + TFT.printf(buf) ; + TFT.fillrect(60,230,180,300,Green); + TFT.locate(85,250) ; + TFT.foreground(Black) ; + TFT.printf("RET") ; + TFT.BusEnable(false) ; + backlight = 1 ; } @@ -157,16 +233,22 @@ void screen_glc() // glc main screen { - //lcd.FillRect(5,127,230,320,COLOR_BLACK); - // lcd.FillRect(5,127,230,320,COLOR_BLACK); - lcd.FillRoundRect(10,130,100,200,COLOR_BLACK); - lcd.FillRoundRect(130,130,220,200,COLOR_BLACK); - lcd.FillRoundRect(10,215,100,285,COLOR_BLACK); - lcd.FillRoundRect(130,215,220,285,COLOR_BLACK); - lcd.FillRoundRect(60,130,180,200,COLOR_YELLOW); - lcd.Print( "START",80,150,COLOR_BLACK,COLOR_YELLOW,0); - lcd.FillRoundRect(60,230,180,300,COLOR_GREEN); - lcd.Print( "RET",100,250,COLOR_BLACK,COLOR_GREEN,0); + 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("RET") ; + TFT.BusEnable(false) ; + backlight = 1 ; } @@ -174,108 +256,158 @@ void screen_bp2() //BP screen 3 { - lcd.FillRoundRect(3,130,200,200,COLOR_BLACK); + /* lcd.FillRoundRect(3,130,200,200,COLOR_BLACK); lcd.FillRoundRect(60,230,180,300,COLOR_BLACK); - lcd.FillRect(5,215,230,290,COLOR_BLACK); + lcd.FillRect(5,215,230,290,COLOR_BLACK);*/ } void ecg_countdown() // ECG measurement countdown { - char tim1[5]; - - // lcd.DrawRect(20,90,90,40,COLOR_BLACK); - // lcd.FillRect(5,127,230,320,COLOR_BLACK); - lcd.FillRoundRect(3,130,200,200,COLOR_BLACK); - lcd.FillRoundRect(60,230,180,300,COLOR_BLACK); - lcd.FillRect(5,215,230,290,COLOR_BLACK); - lcd.Print( "ECG starts in", CENTER, 95); - for(int i=5;i>=0;i--) + 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); - lcd.Print( tim1,120,120,COLOR_YELLOW,COLOR_BLACK, 0); + TFT.locate(120,120) ; + TFT.printf(tim1) ; } - - lcd.Print( "Tst in Progres",3,150,COLOR_GREEN,COLOR_BLACK,0); + TFT.BusEnable(false) ; + backlight = 1 ; + } void bp_countdown() // ECG measurement countdown { - char tim1[5]; - - // lcd.DrawRect(20,90,90,40,COLOR_BLACK); - // lcd.FillRect(5,127,230,320,COLOR_BLACK); - lcd.FillRoundRect(3,130,200,200,COLOR_BLACK); - lcd.FillRoundRect(60,230,180,300,COLOR_BLACK); - lcd.FillRect(5,215,230,290,COLOR_BLACK); - lcd.Print( "BP starts in", CENTER, 95); - for(int i=5;i>=0;i--) + 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("BP starts in") ; + for(int i=5;i>=0;i--) { wait(1); sprintf (tim1, "%d",i); - lcd.Print( tim1,120,120,COLOR_YELLOW,COLOR_BLACK, 0); + TFT.locate(120,120) ; + TFT.printf(tim1) ; } - - lcd.Print( "Tst in Progres",3,150,COLOR_GREEN,COLOR_BLACK,0); - - } + 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) ; - //lcd.DrawRect(20,90,90,40,COLOR_BLACK); - lcd.FillRect(5,127,230,200,COLOR_BLACK); - lcd.Print( "Take test",50,130 ,COLOR_CYAN,COLOR_BLACK, 0); - lcd.Print( "again?",75,160 ,COLOR_CYAN,COLOR_BLACK, 0); - lcd.Print( "YES",30,245,COLOR_BLACK,COLOR_MAGENTA,0); - lcd.Print( " NO ",150,245,COLOR_BLACK,COLOR_GREEN,0); - //lcd.FillRect(5 ,127,230,200,COLOR_BLACK); } void screen_glc_2() // GLC screen 3 after test { - lcd.FillRect(5,127,230,320,COLOR_BLACK); - lcd.FillRoundRect(60,230,180,300,COLOR_GREEN); - lcd.Print( "RET",100,250,COLOR_BLACK,COLOR_GREEN,0); + 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") ; + backlight = 1 ; + TFT.BusEnable(false) ; + + + } void glc_1() // GLC screen - { - - lcd.FillRoundRect(3,130,200,200,COLOR_BLACK); - lcd.FillRoundRect(60,230,180,300,COLOR_BLACK); - lcd.FillRect(5,215,230,290,COLOR_BLACK); - lcd.Print( "BLOOD GLUCOSE",20,130 ,COLOR_CYAN,COLOR_BLACK, 0); // align text to center horizontally and use starndard colors - lcd.Print( "Insert strip",5,160,COLOR_MAGENTA,COLOR_BLACK, 0); // align text to center horizontally and use starndard colors + { + 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.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 { - - lcd.Print( "Strip Detected",5,160, COLOR_GREEN,COLOR_BLACK, 0); - lcd.Print( "Insert Blood",5,190,COLOR_RED,COLOR_BLACK, 0); + 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 { - - lcd.Print( "Blood Detected",5,190,COLOR_GREEN,COLOR_BLACK, 0); - lcd.Print( "computing", 5,220,COLOR_MAGENTA,COLOR_BLACK, 0); - } + 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(unsigned int mgdl) // GLC screen to display blood glucose level on the LCD - { - - lcd.FillRect(5,127,230,320,COLOR_BLACK); - char buf[10]; + { + char buf[10]; sprintf (buf, " BG %d mg/dl",mgdl); - lcd.Print( buf, 5,100,COLOR_YELLOW,COLOR_BLACK, 0); + backlight = 0 ; + TFT.BusEnable(true) ; + TFT.fillrect(5,127,230,320,White); + TFT.locate(5,100) ; + TFT.printf(buf) ; + TFT.BusEnable(false) ; + backlight = 1 ; } \ No newline at end of file