Changes done in ECG and BT

Dependencies:   SDFileSystem ds3231 eeprom_Nikita mbed testUniGraphic_150217

Fork of merged_code2_20sept_2017_4th_oct_2017 by nikita teggi

Files at this revision

API Documentation at this revision

Comitter:
nikitateggi
Date:
Tue Dec 27 10:30:48 2016 +0000
Child:
1:8316c23ec6b9
Commit message:
poc display

Changed in this revision

SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
TFTLCD_8bit.lib Show annotated file Show diff for this revision Revisions of this file
display_modules.cpp Show annotated file Show diff for this revision Revisions of this file
display_modules.h Show annotated file Show diff for this revision Revisions of this file
ds3231.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
touch_modules.cpp Show annotated file Show diff for this revision Revisions of this file
touch_modules.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Tue Dec 27 10:30:48 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/SDFileSystem/#8db0d3b02cec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TFTLCD_8bit.lib	Tue Dec 27 10:30:48 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/ThihaElectronics/code/TFTLCD_8bit/#155abe4126e3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/display_modules.cpp	Tue Dec 27 10:30:48 2016 +0000
@@ -0,0 +1,121 @@
+#include "mbed.h"
+#include "ili9325.h"
+#include "lcd_base.h"
+#include "display_modules.h"
+#include "touch_modules.h"
+
+
+BusOut dataBus( PTC12, PTC13, PTB10, PTC9, PTD4, PTD5, PTD6, PTD7 ); // 16 pins//POC
+ILI9325_LCD lcd( PTC5, PTB9, PTC0, PTB0, &dataBus, NC, PTE31);
+
+
+void init_screen()     // initializing the screen
+{ lcd.Initialize(PORTRAIT);
+}
+
+ void screen_main()//main screen
+ {
+     lcd.SetFont(&TerminusBigFont);
+                lcd.FillRect(5,127,230,320,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( "SET",160,245,COLOR_BLACK,COLOR_GREEN,0);
+                }
+                
+       
+                
+void screen_ecg()
+   {
+   DisableTouch();
+               
+                lcd.ClearScreen();
+    //lcd.FillScreen(COLOR_BLACK);
+   
+   
+                lcd.FillRect(5,127,230,320,COLOR_BLACK); 
+                lcd.FillRect(10,30,100,90,COLOR_GREEN);
+                lcd.FillTriangle(10,30,60,10,100,30,COLOR_YELLOW);
+                lcd.DrawRect(20,90,90,40,COLOR_BLACK);
+                 //lcd.Print( "HOME",80,60,COLOR_BLACK,COLOR_GREEN,0);
+                lcd.FillRoundRect(10,130,100,200,COLOR_CYAN);
+                lcd.Print( "SET",30,160,COLOR_BLACK,COLOR_CYAN,0);
+                lcd.FillRoundRect(130,130,220,285,COLOR_YELLOW);
+                lcd.Print( "start",140,200,COLOR_BLACK,COLOR_YELLOW,0);
+                lcd.FillRoundRect(10,215,100,285,COLOR_MAGENTA);
+                lcd.Print( "HIS",40,245,COLOR_BLACK,COLOR_MAGENTA,0);
+              EnableTouch();
+                } 
+                
+                
+ void screen_bp()          // bp main screen
+ {
+                 DisableTouch();
+                 lcd.ClearScreen();
+  //  lcd.FillScreen(COLOR_BLACK);
+                lcd.FillRect(5,127,230,320,COLOR_BLACK); 
+                lcd.FillRoundRect(10,130,100,200,COLOR_CYAN);
+                lcd.Print( "meas",30,160,COLOR_BLACK,COLOR_CYAN,0);
+                lcd.FillRoundRect(130,130,220,200,COLOR_YELLOW);
+                lcd.Print( "start",140,160,COLOR_BLACK,COLOR_YELLOW,0);
+                lcd.FillRoundRect(10,215,100,285,COLOR_MAGENTA);
+                lcd.Print( "his",40,245,COLOR_BLACK,COLOR_MAGENTA,0);
+                lcd.FillRoundRect(130,215,220,285,COLOR_GREEN);
+                lcd.Print( "SET",160,245,COLOR_BLACK,COLOR_GREEN,0);
+     
+            EnableTouch();
+    }               
+                
+  
+   void screen_glc()     // glc main screen
+ {
+                 DisableTouch();
+                 lcd.ClearScreen();
+   // lcd.FillScreen(COLOR_BLACK);
+                lcd.FillRect(5,127,230,320,COLOR_BLACK); 
+                lcd.FillRoundRect(10,130,100,200,COLOR_CYAN);
+                lcd.Print( "meas",30,160,COLOR_BLACK,COLOR_CYAN,0);
+                lcd.FillRoundRect(130,130,220,200,COLOR_YELLOW);
+                lcd.Print( "start",140,160,COLOR_BLACK,COLOR_YELLOW,0);
+                lcd.FillRoundRect(10,215,100,285,COLOR_MAGENTA);
+                lcd.Print( "his",40,245,COLOR_BLACK,COLOR_MAGENTA,0);
+                lcd.FillRoundRect(130,215,220,285,COLOR_GREEN);
+                lcd.Print( "SET",160,245,COLOR_BLACK,COLOR_GREEN,0);
+     
+            EnableTouch();
+    }               
+
+
+void screen_ecg_2()     // ecg second screen 
+{
+      DisableTouch();
+           
+                lcd.ClearScreen();
+   // lcd.FillScreen(COLOR_BLACK);
+   
+                lcd.FillRect(10,30,100,90,COLOR_GREEN);
+                lcd.FillTriangle(10,30,60,10,100,30,COLOR_YELLOW);
+                lcd.DrawRect(20,90,90,40,COLOR_BLACK);
+                //lcd.FillRect(5,127,230,320,COLOR_BLACK); 
+                //lcd.FillRect(60,30,170,90,COLOR_GREEN);
+                //lcd.FillTriangle(60,30,115,10,170,30,COLOR_YELLOW);
+                //lcd.DrawRect(90,90,140,40,COLOR_BLACK);
+                 //lcd.Print( "HOME",80,60,COLOR_BLACK,COLOR_GREEN,0);
+                lcd.FillRoundRect(10,130,100,200,COLOR_CYAN);
+                lcd.Print( "2 s",30,160,COLOR_BLACK,COLOR_CYAN,0);
+                lcd.FillRoundRect(130,130,220,200,COLOR_YELLOW);
+                lcd.Print( "5 s",140,160,COLOR_BLACK,COLOR_YELLOW,0);
+                lcd.FillRoundRect(10,215,100,285,COLOR_MAGENTA);
+                lcd.Print( "10 s",40,245,COLOR_BLACK,COLOR_MAGENTA,0);
+                lcd.FillRoundRect(130,215,220,285,COLOR_GREEN);
+                lcd.Print( "1 m",160,245,COLOR_BLACK,COLOR_GREEN,0);
+     
+            EnableTouch();
+             }
+     
+     
+                    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/display_modules.h	Tue Dec 27 10:30:48 2016 +0000
@@ -0,0 +1,15 @@
+#ifndef DISPLAY_MODULES_H_
+#define DISPLAY_MODULES_H_
+
+
+
+void screen_main();//main screen
+void screen_ecg();
+void screen_bp();
+void screen_glc();
+ void init_screen();
+ void screen_ecg_2();
+ 
+
+
+#endif 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ds3231.lib	Tue Dec 27 10:30:48 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/Maxim-Integrated/code/ds3231/#11630748e2f2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Dec 27 10:30:48 2016 +0000
@@ -0,0 +1,101 @@
+#include "mbed.h"
+#include "ili9325.h"
+#include "lcd_base.h"
+#include "display_modules.h"
+#include "touch_modules.h"
+
+
+
+Serial gc(USBTX, USBRX);
+DigitalIn q1(PTB11);
+DigitalIn q(PTB8);
+
+
+
+
+int main(){
+
+
+unsigned char state;
+unsigned char state1;
+unsigned char state2;
+      
+      
+  DisableTouch();
+    
+     
+  gc.baud(115200);
+  init_screen();    //initialize lcd
+  screen_main();    // display of main screen 
+   state=1;
+   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;
+                 break;
+               
+      case 2: 
+                state1=touch_glc();    // determining the touch for glc screen 
+                state=0;
+                break;
+                
+      case 3:  
+               state1=touch_ecg();     // determining the touch for ecg screen 
+                state=0;
+                break;
+        
+      case 4: 
+                state1=touch_bp();     // determining the touch for bp screen 
+                state=0;
+                break;       
+                
+    }         
+     
+
+  
+  
+  
+ switch(state1)
+  {
+      
+      case 1: 
+                screen_glc();      // glc main screen 
+                state1=0;
+                state=2;
+                
+                break;
+               
+      case 2: 
+                screen_ecg();      // ecg main screen 
+                state1=0;
+                state=3;
+                break;
+                
+      case 3: 
+                screen_bp();       //bp main screen 
+                 state1=0;
+                 state=4;
+                break;
+                
+            
+    }            
+    
+           
+                
+                
+                
+  }              
+                
+  
+}
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Dec 27 10:30:48 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9baf128c2fab
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/touch_modules.cpp	Tue Dec 27 10:30:48 2016 +0000
@@ -0,0 +1,234 @@
+#include "mbed.h"
+#include "ili9325.h"
+#include "lcd_base.h"
+#include "display_modules.h"
+#include "touch_modules.h"
+InterruptIn Touch_D(PTD6);
+int i;
+unsigned int xt;
+unsigned int yt;
+
+
+
+void touch1()  //determining the touch co-ordinates
+{
+   xt = (X_MAX*readTouchX()/TOTAL1);
+            yt = (Y_MAX*readTouchY()/TOTAL1);
+    }
+
+
+void detect_touch()   // detect the touch //debounce
+{
+    
+while(i==1)
+{
+    while(Touch_D)//touch detection 
+    {
+         wait_ms(200); ///wait for debounce check
+           if (Touch_D)
+           {  
+             Touch_D.fall(&touch1);  //determine the touch co-ordinates
+             break;
+            }
+         DisableTouch(); 
+               
+         }
+ }
+  }
+
+
+
+unsigned char touch_main()    //determining the touch for home screen
+{
+    
+    unsigned char state;
+        
+                  if ( ((xt >=35) && (xt<=100)) && ( (yt>= 135) && (yt<= 185) ) ) // GLC
+                       {
+                          
+                          state=1;
+                        }
+    
+                 else if ( ((xt >=130) && (xt<=195)) && ( (yt>= 135) && (yt<= 185) ) ) // ECG
+                      {
+                           state=2;
+                        
+                          
+                       }
+                 else if ( ((xt >= 35) && (xt<=100)) && ( (yt>= 65) && (yt<= 118) ) ) // BP
+                      {
+                                state=3;
+                         
+                       }
+                 else if ( ((xt >= 130) && (xt<=195)) && ( (yt>= 65) && (yt<= 118) ) ) // SET
+                       {
+                                 state=4;
+                        
+                       }
+                   
+         return state;     
+    }
+   
+   
+
+unsigned char touch_ecg()     // determining the touch for ecg screen
+{
+      
+      unsigned char state;
+if ( ((xt >=28) && (xt<=125)) && ( (yt>= 225) && (yt<= 285) ) ) // home screen 
+                            {
+                                
+                                state=5;
+                            }
+         
+                      if ( ((xt >=35) && (xt<=100)) && ( (yt>= 135) && (yt<= 185) ) ) // SET
+                            {
+                               state=6;
+                               
+                            }
+         
+                    else if ( ((xt >=150) && (xt<=195)) && ( (yt>= 80) && (yt<= 190) ) ) // start
+                            {
+                                 state=7;
+                             }
+      
+                    else if ( ((xt >= 35) && (xt<=100)) && ( (yt>= 65) && (yt<= 118) ) ) // history
+                            {
+                              state=8;
+      
+                             }
+                
+           return state;
+    }
+    
+
+
+unsigned char touch_bp()   // //determining the touch for bp screen
+
+{
+        unsigned char state;
+if ( ((xt >=28) && (xt<=125)) && ( (yt>= 225) && (yt<= 285) ) ) 
+                       {
+                          state=1;
+                     
+                       }
+         
+                 else if ( ((xt >=35) && (xt<=100)) && ( (yt>= 135) && (yt<= 185) ) ) 
+                       {
+                          
+                          state=2;
+                      
+                        }
+    
+                 else if ( ((xt >=130) && (xt<=195)) && ( (yt>= 135) && (yt<= 185) ) ) 
+                      {
+                           state=3;
+                         
+                          
+                       }
+                 else if ( ((xt >= 35) && (xt<=100)) && ( (yt>= 65) && (yt<= 118) ) ) 
+                      {
+                                state=4;
+                        
+                       }
+                 else if ( ((xt >= 130) && (xt<=195)) && ( (yt>= 65) && (yt<= 118) ) )
+                       {
+                                 state=5;
+                        
+                       }
+    
+           
+           return state;
+    }
+    
+    
+    
+unsigned char touch_glc()        ////determining the touch for home screen
+    {
+        unsigned char state;
+if ( ((xt >=28) && (xt<=125)) && ( (yt>= 225) && (yt<= 285) ) ) 
+                       {
+                          state=1;
+                        }
+         
+                 else if ( ((xt >=35) && (xt<=100)) && ( (yt>= 135) && (yt<= 185) ) ) 
+                       {
+                          
+                          state=2;
+                      
+                        }
+    
+                 else if ( ((xt >=130) && (xt<=195)) && ( (yt>= 135) && (yt<= 185) ) ) 
+                      {
+                           state=3;
+                       
+                          
+                       }
+                 else if ( ((xt >= 35) && (xt<=100)) && ( (yt>= 65) && (yt<= 118) ) )
+                      {
+                                state=4;
+                      
+                       }
+                 else if ( ((xt >= 130) && (xt<=195)) && ( (yt>= 65) && (yt<= 118) ) ) // SET
+                       {
+                                 state=5;
+                         
+                       }
+    
+           
+           return state;
+    } 
+      
+
+
+
+int readTouchY(void) {
+    DigitalOut YD(PTD6);
+     DigitalIn XL(PTD7);
+     DigitalOut YU(PTC0);
+     YU = 1;
+     YD = 0;
+     AnalogIn XR(PTB0);
+     XL.mode(PullNone);
+     return XR.read_u16();
+}
+    
+int readTouchX(void) {
+    DigitalOut XR(PTB0);
+    DigitalIn YD(PTD6);
+     DigitalOut XL(PTD7);
+     
+     XR = 1;
+     XL = 0;
+     AnalogIn YU(PTC0);
+     YD.mode(PullNone);
+     return YU.read_u16();
+}
+
+void EnableTouch(void){
+    
+    DigitalIn YD(PTD6);
+    DigitalOut XL(PTD7);
+    DigitalIn YU(PTC0);
+    DigitalIn XR(PTB0);
+     XL=0;
+      YD.mode(PullUp);
+     YU.mode(PullNone);
+     XR.mode(PullNone);
+   i=1;
+    Touch_D.fall(&touch1);
+    Touch_D.enable_irq();
+   
+    }
+void DisableTouch (void){
+    Touch_D.disable_irq();
+    i=0;
+    DigitalOut YD(PTD6);
+    DigitalOut XL(PTD7);
+    DigitalOut YU(PTC0);
+    DigitalOut XR(PTB0);
+    }
+    
+    
+   
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/touch_modules.h	Tue Dec 27 10:30:48 2016 +0000
@@ -0,0 +1,19 @@
+#ifndef TOUCH_MODULES_H_
+#define TOUCH_MODULES_H_
+
+#define TOTAL1 65535
+#define X_MAX 240
+#define Y_MAX 320
+unsigned char touch_main();
+void touch1() ;
+int readTouchY(void);
+void detect_touch();
+int readTouchX(void);
+void EnableTouch(void);
+void DisableTouch (void);
+unsigned char touch_main();
+unsigned char touch_glc();
+unsigned char touch_ecg();
+unsigned char touch_bp();
+
+#endif
\ No newline at end of file