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@1:8316c23ec6b9, 2017-01-30 (annotated)
- Committer:
- nikitateggi
- Date:
- Mon Jan 30 07:45:41 2017 +0000
- Revision:
- 1:8316c23ec6b9
- Parent:
- 0:c47fb0c1bbf6
- Child:
- 2:3b7b71bfc941
POC code
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nikitateggi | 0:c47fb0c1bbf6 | 1 | #include "mbed.h" |
nikitateggi | 0:c47fb0c1bbf6 | 2 | #include "ili9325.h" |
nikitateggi | 0:c47fb0c1bbf6 | 3 | #include "lcd_base.h" |
nikitateggi | 0:c47fb0c1bbf6 | 4 | #include "display_modules.h" |
nikitateggi | 0:c47fb0c1bbf6 | 5 | #include "touch_modules.h" |
nikitateggi | 1:8316c23ec6b9 | 6 | #include "rtc.h" |
nikitateggi | 1:8316c23ec6b9 | 7 | #include "main.h" |
nikitateggi | 0:c47fb0c1bbf6 | 8 | |
nikitateggi | 0:c47fb0c1bbf6 | 9 | |
nikitateggi | 0:c47fb0c1bbf6 | 10 | BusOut dataBus( PTC12, PTC13, PTB10, PTC9, PTD4, PTD5, PTD6, PTD7 ); // 16 pins//POC |
nikitateggi | 0:c47fb0c1bbf6 | 11 | ILI9325_LCD lcd( PTC5, PTB9, PTC0, PTB0, &dataBus, NC, PTE31); |
nikitateggi | 0:c47fb0c1bbf6 | 12 | |
nikitateggi | 0:c47fb0c1bbf6 | 13 | |
nikitateggi | 1:8316c23ec6b9 | 14 | void init_screen() // initializing the screen |
nikitateggi | 1:8316c23ec6b9 | 15 | { |
nikitateggi | 1:8316c23ec6b9 | 16 | lcd.Initialize(PORTRAIT); |
nikitateggi | 1:8316c23ec6b9 | 17 | } |
nikitateggi | 0:c47fb0c1bbf6 | 18 | |
nikitateggi | 0:c47fb0c1bbf6 | 19 | void screen_main()//main screen |
nikitateggi | 0:c47fb0c1bbf6 | 20 | { |
nikitateggi | 1:8316c23ec6b9 | 21 | char buff1[32]; |
nikitateggi | 1:8316c23ec6b9 | 22 | time_t epoch_time; |
nikitateggi | 1:8316c23ec6b9 | 23 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 24 | lcd.ClearScreen(); |
nikitateggi | 1:8316c23ec6b9 | 25 | lcd.SetFont(&TerminusFont); |
nikitateggi | 1:8316c23ec6b9 | 26 | epoch_time=rtc_read(); |
nikitateggi | 1:8316c23ec6b9 | 27 | sprintf(buff1 ,"%s", ctime(&epoch_time)); |
nikitateggi | 1:8316c23ec6b9 | 28 | lcd.Print( buff1,20,100,COLOR_YELLOW,COLOR_BLACK, 0); |
nikitateggi | 1:8316c23ec6b9 | 29 | lcd.SetFont(&TerminusBigFont); |
nikitateggi | 1:8316c23ec6b9 | 30 | lcd.Print( "SENSESEMI",50,20,COLOR_WHITE,COLOR_BLACK, 0); |
nikitateggi | 1:8316c23ec6b9 | 31 | lcd.Print( "SenseSmart",45,60,COLOR_WHITE,COLOR_BLACK, 0);// align text to center horizontally and use starndard colors |
nikitateggi | 1:8316c23ec6b9 | 32 | lcd.FillRoundRect(60,130,180,200,COLOR_YELLOW); |
nikitateggi | 1:8316c23ec6b9 | 33 | lcd.Print( "SYS",100,140,COLOR_BLACK,COLOR_YELLOW,0); |
nikitateggi | 1:8316c23ec6b9 | 34 | lcd.Print( "CONFIG",70,170,COLOR_BLACK,COLOR_YELLOW,0); |
nikitateggi | 1:8316c23ec6b9 | 35 | lcd.FillRoundRect(60,230,180,300,COLOR_GREEN); |
nikitateggi | 1:8316c23ec6b9 | 36 | lcd.Print( "TEST",90,250,COLOR_BLACK,COLOR_GREEN,0); |
nikitateggi | 1:8316c23ec6b9 | 37 | EnableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 38 | |
nikitateggi | 1:8316c23ec6b9 | 39 | } |
nikitateggi | 1:8316c23ec6b9 | 40 | |
nikitateggi | 1:8316c23ec6b9 | 41 | void screen_main_2(int pid)//main screen |
nikitateggi | 1:8316c23ec6b9 | 42 | { |
nikitateggi | 1:8316c23ec6b9 | 43 | |
nikitateggi | 1:8316c23ec6b9 | 44 | char buff2[10]; |
nikitateggi | 1:8316c23ec6b9 | 45 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 46 | lcd.FillRect(5,10,250,120,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 47 | //lcd.Print( "SenseSmart", CENTER, 95); |
nikitateggi | 1:8316c23ec6b9 | 48 | sprintf(buff2 ,"%d", pid); |
nikitateggi | 1:8316c23ec6b9 | 49 | lcd.Print( "PATIENT ID",20,50,COLOR_YELLOW,COLOR_BLACK, 0); |
nikitateggi | 1:8316c23ec6b9 | 50 | lcd.Print(buff2,200,50,COLOR_YELLOW,COLOR_BLACK, 0); |
nikitateggi | 1:8316c23ec6b9 | 51 | |
nikitateggi | 1:8316c23ec6b9 | 52 | lcd.SetFont(&TerminusBigFont); |
nikitateggi | 1:8316c23ec6b9 | 53 | lcd.FillRect(5,120,230,320,COLOR_BLACK); |
nikitateggi | 0:c47fb0c1bbf6 | 54 | lcd.FillRoundRect(10,130,100,200,COLOR_CYAN); |
nikitateggi | 0:c47fb0c1bbf6 | 55 | lcd.Print( "BG",40,160,COLOR_BLACK,COLOR_CYAN,0); |
nikitateggi | 0:c47fb0c1bbf6 | 56 | lcd.FillRoundRect(130,130,220,200,COLOR_YELLOW); |
nikitateggi | 0:c47fb0c1bbf6 | 57 | lcd.Print( "ECG",160,160,COLOR_BLACK,COLOR_YELLOW,0); |
nikitateggi | 0:c47fb0c1bbf6 | 58 | lcd.FillRoundRect(10,215,100,285,COLOR_MAGENTA); |
nikitateggi | 0:c47fb0c1bbf6 | 59 | lcd.Print( "BP",40,245,COLOR_BLACK,COLOR_MAGENTA,0); |
nikitateggi | 0:c47fb0c1bbf6 | 60 | lcd.FillRoundRect(130,215,220,285,COLOR_GREEN); |
nikitateggi | 1:8316c23ec6b9 | 61 | lcd.Print( "HOME",150,245,COLOR_BLACK,COLOR_GREEN,0); |
nikitateggi | 1:8316c23ec6b9 | 62 | EnableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 63 | } |
nikitateggi | 1:8316c23ec6b9 | 64 | |
nikitateggi | 1:8316c23ec6b9 | 65 | |
nikitateggi | 0:c47fb0c1bbf6 | 66 | |
nikitateggi | 1:8316c23ec6b9 | 67 | void screen_main_1()//main screen |
nikitateggi | 1:8316c23ec6b9 | 68 | { |
nikitateggi | 1:8316c23ec6b9 | 69 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 70 | lcd.SetFont(&TerminusBigFont); |
nikitateggi | 1:8316c23ec6b9 | 71 | lcd.FillRect(5,127,230,320,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 72 | lcd.FillRoundRect(10,130,100,200,COLOR_CYAN); |
nikitateggi | 1:8316c23ec6b9 | 73 | lcd.Print( "BLE",30,160,COLOR_BLACK,COLOR_CYAN,0); |
nikitateggi | 1:8316c23ec6b9 | 74 | lcd.FillRoundRect(130,130,220,200,COLOR_YELLOW); |
nikitateggi | 1:8316c23ec6b9 | 75 | lcd.Print( "ERASE",140,160,COLOR_BLACK,COLOR_YELLOW,0); |
nikitateggi | 1:8316c23ec6b9 | 76 | lcd.FillRoundRect(10,215,100,285,COLOR_MAGENTA); |
nikitateggi | 1:8316c23ec6b9 | 77 | lcd.Print( "FILE",20,245,COLOR_BLACK,COLOR_MAGENTA,0); |
nikitateggi | 1:8316c23ec6b9 | 78 | lcd.FillRoundRect(130,215,220,285,COLOR_GREEN); |
nikitateggi | 1:8316c23ec6b9 | 79 | lcd.Print( "HOME",145,245,COLOR_BLACK,COLOR_GREEN,0); |
nikitateggi | 1:8316c23ec6b9 | 80 | EnableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 81 | } |
nikitateggi | 0:c47fb0c1bbf6 | 82 | |
nikitateggi | 0:c47fb0c1bbf6 | 83 | |
nikitateggi | 0:c47fb0c1bbf6 | 84 | void screen_ecg() |
nikitateggi | 0:c47fb0c1bbf6 | 85 | { |
nikitateggi | 1:8316c23ec6b9 | 86 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 87 | lcd.FillRect(5,127,230,320,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 88 | lcd.FillRoundRect(60,130,180,200,COLOR_YELLOW); |
nikitateggi | 1:8316c23ec6b9 | 89 | lcd.Print( "START",80,150,COLOR_BLACK,COLOR_YELLOW,0); |
nikitateggi | 1:8316c23ec6b9 | 90 | // lcd.Print( "CONFIG",70,170,COLOR_BLACK,COLOR_YELLOW,0); |
nikitateggi | 1:8316c23ec6b9 | 91 | lcd.FillRoundRect(60,230,180,300,COLOR_GREEN); |
nikitateggi | 1:8316c23ec6b9 | 92 | lcd.Print( "RET",100,250,COLOR_BLACK,COLOR_GREEN,0); |
nikitateggi | 1:8316c23ec6b9 | 93 | EnableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 94 | } |
nikitateggi | 1:8316c23ec6b9 | 95 | |
nikitateggi | 1:8316c23ec6b9 | 96 | |
nikitateggi | 0:c47fb0c1bbf6 | 97 | |
nikitateggi | 1:8316c23ec6b9 | 98 | void screen_ecg_2() |
nikitateggi | 1:8316c23ec6b9 | 99 | { |
nikitateggi | 1:8316c23ec6b9 | 100 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 101 | // lcd.FillRect(5,90,230,320,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 102 | // lcd.Print( "DONE", CENTER, 95); |
nikitateggi | 1:8316c23ec6b9 | 103 | lcd.FillRoundRect(60,230,180,300,COLOR_GREEN); |
nikitateggi | 1:8316c23ec6b9 | 104 | lcd.Print( "RET",100,250,COLOR_BLACK,COLOR_GREEN,0); |
nikitateggi | 1:8316c23ec6b9 | 105 | EnableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 106 | } |
nikitateggi | 1:8316c23ec6b9 | 107 | |
nikitateggi | 1:8316c23ec6b9 | 108 | |
nikitateggi | 0:c47fb0c1bbf6 | 109 | |
nikitateggi | 0:c47fb0c1bbf6 | 110 | void screen_bp() // bp main screen |
nikitateggi | 0:c47fb0c1bbf6 | 111 | { |
nikitateggi | 1:8316c23ec6b9 | 112 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 113 | lcd.FillRect(5,127,230,320,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 114 | lcd.FillRoundRect(60,130,180,200,COLOR_YELLOW); |
nikitateggi | 1:8316c23ec6b9 | 115 | lcd.Print( "START",80,150,COLOR_BLACK,COLOR_YELLOW,0); |
nikitateggi | 1:8316c23ec6b9 | 116 | // lcd.Print( "CONFIG",70,170,COLOR_BLACK,COLOR_YELLOW,0); |
nikitateggi | 1:8316c23ec6b9 | 117 | lcd.FillRoundRect(60,230,180,300,COLOR_GREEN); |
nikitateggi | 1:8316c23ec6b9 | 118 | lcd.Print( "RET",100,250,COLOR_BLACK,COLOR_GREEN,0); |
nikitateggi | 1:8316c23ec6b9 | 119 | EnableTouch(); |
nikitateggi | 0:c47fb0c1bbf6 | 120 | } |
nikitateggi | 0:c47fb0c1bbf6 | 121 | |
nikitateggi | 0:c47fb0c1bbf6 | 122 | |
nikitateggi | 1:8316c23ec6b9 | 123 | void screen_glc() // glc main screen |
nikitateggi | 0:c47fb0c1bbf6 | 124 | { |
nikitateggi | 1:8316c23ec6b9 | 125 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 126 | //lcd.FillRect(5,127,230,320,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 127 | lcd.FillRect(5,127,230,320,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 128 | lcd.FillRoundRect(60,130,180,200,COLOR_YELLOW); |
nikitateggi | 1:8316c23ec6b9 | 129 | lcd.Print( "START",80,150,COLOR_BLACK,COLOR_YELLOW,0); |
nikitateggi | 1:8316c23ec6b9 | 130 | lcd.FillRoundRect(60,230,180,300,COLOR_GREEN); |
nikitateggi | 1:8316c23ec6b9 | 131 | lcd.Print( "RET",100,250,COLOR_BLACK,COLOR_GREEN,0); |
nikitateggi | 1:8316c23ec6b9 | 132 | EnableTouch(); |
nikitateggi | 0:c47fb0c1bbf6 | 133 | } |
nikitateggi | 0:c47fb0c1bbf6 | 134 | |
nikitateggi | 0:c47fb0c1bbf6 | 135 | |
nikitateggi | 1:8316c23ec6b9 | 136 | |
nikitateggi | 1:8316c23ec6b9 | 137 | |
nikitateggi | 1:8316c23ec6b9 | 138 | |
nikitateggi | 1:8316c23ec6b9 | 139 | void ecg_countdown() |
nikitateggi | 1:8316c23ec6b9 | 140 | { |
nikitateggi | 1:8316c23ec6b9 | 141 | char tim1[5]; |
nikitateggi | 0:c47fb0c1bbf6 | 142 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 143 | lcd.DrawRect(20,90,90,40,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 144 | lcd.FillRect(5,127,230,320,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 145 | lcd.Print( "ECG starts in", CENTER, 95); |
nikitateggi | 1:8316c23ec6b9 | 146 | for(int i=5;i>=0;i--) |
nikitateggi | 1:8316c23ec6b9 | 147 | { |
nikitateggi | 1:8316c23ec6b9 | 148 | wait(1); |
nikitateggi | 1:8316c23ec6b9 | 149 | sprintf (tim1, "%d",i); |
nikitateggi | 1:8316c23ec6b9 | 150 | lcd.Print( tim1,120,120,COLOR_YELLOW,COLOR_BLACK, 0); |
nikitateggi | 1:8316c23ec6b9 | 151 | |
nikitateggi | 1:8316c23ec6b9 | 152 | } |
nikitateggi | 1:8316c23ec6b9 | 153 | EnableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 154 | } |
nikitateggi | 1:8316c23ec6b9 | 155 | |
nikitateggi | 1:8316c23ec6b9 | 156 | |
nikitateggi | 1:8316c23ec6b9 | 157 | |
nikitateggi | 1:8316c23ec6b9 | 158 | void screen_again() |
nikitateggi | 1:8316c23ec6b9 | 159 | { |
nikitateggi | 1:8316c23ec6b9 | 160 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 161 | //lcd.DrawRect(20,90,90,40,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 162 | lcd.FillRect(5,127,230,200,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 163 | lcd.Print( "Take test",50,130 ,COLOR_CYAN,COLOR_BLACK, 0); |
nikitateggi | 1:8316c23ec6b9 | 164 | lcd.Print( "again?",75,160 ,COLOR_CYAN,COLOR_BLACK, 0); |
nikitateggi | 1:8316c23ec6b9 | 165 | lcd.Print( "YES",30,245,COLOR_BLACK,COLOR_MAGENTA,0); |
nikitateggi | 1:8316c23ec6b9 | 166 | |
nikitateggi | 1:8316c23ec6b9 | 167 | lcd.Print( " NO ",150,245,COLOR_BLACK,COLOR_GREEN,0); |
nikitateggi | 1:8316c23ec6b9 | 168 | //lcd.FillRect(5 ,127,230,200,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 169 | } |
nikitateggi | 1:8316c23ec6b9 | 170 | |
nikitateggi | 1:8316c23ec6b9 | 171 | |
nikitateggi | 1:8316c23ec6b9 | 172 | void screen_glc_2() |
nikitateggi | 1:8316c23ec6b9 | 173 | { |
nikitateggi | 1:8316c23ec6b9 | 174 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 175 | lcd.FillRect(5,127,230,320,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 176 | |
nikitateggi | 0:c47fb0c1bbf6 | 177 | |
nikitateggi | 1:8316c23ec6b9 | 178 | lcd.FillRoundRect(60,230,180,300,COLOR_GREEN); |
nikitateggi | 1:8316c23ec6b9 | 179 | lcd.Print( "RET",100,250,COLOR_BLACK,COLOR_GREEN,0); |
nikitateggi | 1:8316c23ec6b9 | 180 | EnableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 181 | } |
nikitateggi | 1:8316c23ec6b9 | 182 | |
nikitateggi | 1:8316c23ec6b9 | 183 | void glc_1() |
nikitateggi | 1:8316c23ec6b9 | 184 | { |
nikitateggi | 1:8316c23ec6b9 | 185 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 186 | //lcd.ClearScreen(); |
nikitateggi | 1:8316c23ec6b9 | 187 | lcd.DrawRect(20,90,90,40,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 188 | lcd.FillRect(5,127,230,320,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 189 | lcd.Print( "BLOOD GLUCOSE",20,130 ,COLOR_CYAN,COLOR_BLACK, 0); // align text to center horizontally and use starndard colors |
nikitateggi | 1:8316c23ec6b9 | 190 | lcd.Print( "Insert strip",5,160,COLOR_MAGENTA,COLOR_BLACK, 0); // align text to center horizontally and use starndard colors |
nikitateggi | 1:8316c23ec6b9 | 191 | } |
nikitateggi | 1:8316c23ec6b9 | 192 | |
nikitateggi | 1:8316c23ec6b9 | 193 | void glc_2() |
nikitateggi | 1:8316c23ec6b9 | 194 | { |
nikitateggi | 1:8316c23ec6b9 | 195 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 196 | lcd.Print( "Strip Detected",5,160, COLOR_GREEN,COLOR_BLACK, 0); |
nikitateggi | 1:8316c23ec6b9 | 197 | lcd.Print( "Insert Blood",5,190,COLOR_RED,COLOR_BLACK, 0); |
nikitateggi | 1:8316c23ec6b9 | 198 | } |
nikitateggi | 0:c47fb0c1bbf6 | 199 | |
nikitateggi | 1:8316c23ec6b9 | 200 | void glc_3() |
nikitateggi | 1:8316c23ec6b9 | 201 | { |
nikitateggi | 1:8316c23ec6b9 | 202 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 203 | lcd.Print( "Blood Detected",5,190,COLOR_GREEN,COLOR_BLACK, 0); |
nikitateggi | 1:8316c23ec6b9 | 204 | lcd.Print( "computing", 5,220,COLOR_MAGENTA,COLOR_BLACK, 0); |
nikitateggi | 1:8316c23ec6b9 | 205 | } |
nikitateggi | 1:8316c23ec6b9 | 206 | |
nikitateggi | 1:8316c23ec6b9 | 207 | void glc_4(unsigned int mgdl) |
nikitateggi | 1:8316c23ec6b9 | 208 | { |
nikitateggi | 1:8316c23ec6b9 | 209 | DisableTouch(); |
nikitateggi | 1:8316c23ec6b9 | 210 | lcd.FillRect(5,127,230,320,COLOR_BLACK); |
nikitateggi | 1:8316c23ec6b9 | 211 | char buf[10]; |
nikitateggi | 1:8316c23ec6b9 | 212 | sprintf (buf, "BG is %d mgdl",mgdl); |
nikitateggi | 1:8316c23ec6b9 | 213 | lcd.Print( buf, 5,100,COLOR_YELLOW,COLOR_BLACK, 0); |
nikitateggi | 1:8316c23ec6b9 | 214 | } |