Aseem code LCD

Dependencies:   BSP_DISCO_F769NI

Files at this revision

API Documentation at this revision

Comitter:
asingh2
Date:
Fri Jul 24 21:12:42 2020 +0000
Parent:
0:e97055638fc1
Commit message:
new code 7-24-20

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Jul 21 22:51:09 2020 +0000
+++ b/main.cpp	Fri Jul 24 21:12:42 2020 +0000
@@ -11,72 +11,20 @@
 AnalogOut Aout(A1); //Write Analog output 
 DigitalOut Dout(D0); //Write PWM output
 float ADCdata;
-/**
-  * @brief  Show LCD Features
-  * @param  feature : feature index
-  * @retval None
-  */
-/*static void LCD_Show_Feature(uint8_t feature)
-{
-    Point Points[] = {{20, 150}, {80, 150}, {80, 200}};
-    Point Points2[3];
 
-    Points2[0].X = Xsize - 80;
-    Points2[0].Y = 150;
-    Points2[1].X = Xsize - 20;
-    Points2[1].Y = 150;
-    Points2[2].X = Xsize - 20;
-    Points2[2].Y = 200;
+/*
 
     BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
     BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
-    BSP_LCD_FillRect(12, 92, Xsize - 24, Ysize - 104);
     BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
-
-    switch (feature) {
-        case 0:
-            /* Text Feature */
-/*
-             sd.mount();
+    BSP_LCD_SetTextColor(LCD_COLOR_GRAY);
+    BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
+    BSP_LCD_SetTextColor(LCD_COLOR_RED);
     
-    lcd.DrawBitmap(0,0,(uint8_t *)"/sd/BD_Logo.bmp");  /* right click and save as target for SD card */     
-/*           break;
-
-     /*   case 1: update to case of showing nothing
-
-            /* Draw misc. Shapes */
-     /*       BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
-            BSP_LCD_DrawRect(20, 100, 60, 40);
-            BSP_LCD_FillRect(100, 100, 60, 40);
+*/
 
-            BSP_LCD_SetTextColor(LCD_COLOR_GRAY);
-            BSP_LCD_DrawCircle(Xsize - 120, 120, 20);
-            BSP_LCD_FillCircle(Xsize - 40, 120, 20);
-
-            BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
-            BSP_LCD_DrawPolygon(Points, 3);
-
-            BSP_LCD_SetTextColor(LCD_COLOR_RED);
-            BSP_LCD_DrawEllipse(130, 170, 30, 20);
-            BSP_LCD_FillEllipse(200, 170, 30, 20);
-
-            BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
-            BSP_LCD_DrawHLine(20, Ysize - 30, Xsize / 5);
-            BSP_LCD_DrawLine(100, Ysize - 20, 230, Ysize - 50);
-            BSP_LCD_DrawLine(100, Ysize - 50, 230, Ysize - 20);
-
-            BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
-            BSP_LCD_FillPolygon(Points2, 3);
-            break;
-
-    }
-}
-
-*/
 int main()
 {
-   uint8_t LCD_Feature = 0; /*Use when bd.lgo bitmap is in case 0*/
-
     BSP_LCD_Init();
     // BSP_LCD_InitEx(LCD_ORIENTATION_PORTRAIT);
     BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS);
@@ -85,28 +33,31 @@
     Xsize = BSP_LCD_GetXSize();
     Ysize = BSP_LCD_GetYSize();
     BSP_LCD_Clear(LCD_COLOR_WHITE);
-    BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
-    BSP_LCD_FillRect(0, 0, Xsize, 80);
     BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
-    BSP_LCD_SetBackColor(LCD_COLOR_BLUE);
+    BSP_LCD_SetBackColor(LCD_COLOR_GRAY);
     BSP_LCD_SetFont(&Font24);
-    BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"ThrillSeeker Fistula Health Monitor", CENTER_MODE);
-    BSP_LCD_SetFont(&Font12);
+    
+    BSP_LCD_DisplayStringAt(0, 50, (uint8_t *)"ThrillSeeker Fistula Health Monitor", CENTER_MODE);
+    
     HAL_Delay(2000);
-   BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"Detection Ready: Place armband on Fistula Arm", CENTER_MODE);
-
-    BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
-    BSP_LCD_DrawRect(10, 90, Xsize - 20, Ysize - 100);
-    BSP_LCD_DrawRect(11, 91, Xsize - 22, Ysize - 102);
-
-    HAL_Delay(1000);
+    pc.printf("ThrillSeeker First Demo Run\n Press any key to continue\n");
+  //  wait (3.0);
+    
+    BSP_LCD_Clear(LCD_COLOR_WHITE);
+    BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
+    BSP_LCD_SetBackColor(LCD_COLOR_GRAY);
+    BSP_LCD_SetFont(&Font24);
+    BSP_LCD_DisplayStringAt(0, 50, (uint8_t *)"Detection Ready: Place armband on Fistula Arm", CENTER_MODE);
+    HAL_Delay(2000);
+    
 
     while (1) {
+       
        /* LCD_Show_Feature(LCD_Feature); remove when using sd card or bitmap*/
         ADCdata=Ain;
         PwmOut PWMout(D6); // output off PWM pin D6/PWM11
         
-        HAL_Delay(3000);
+        //HAL_Delay(3000);
         
       
      if (ADCdata<0.2) {
@@ -119,8 +70,16 @@
      
      PWMout.period_ms(10);   //PERIOD in mili second   --FREQUENCY
      PWMout.write(0.1f);   // Duty cycle  10% 
-        BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"Abnormality detected: Please Consult Physician", CENTER_MODE);
-     wait(2.0);
+       
+    BSP_LCD_Clear(LCD_COLOR_WHITE);
+    BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
+    BSP_LCD_SetBackColor(LCD_COLOR_GRAY);
+    BSP_LCD_SetFont(&Font24);
+        BSP_LCD_DisplayStringAt(0, 50, (uint8_t *)"Fistula is Normal", CENTER_MODE);
+     HAL_Delay(1000);
+     pc.printf("%f \n\r",ADCdata);
+     printf(" Normal Fistula \n");
+     
      }
      else if ((0.2 <= ADCdata) && (ADCdata <0.85)) {
          Dout=1;
@@ -129,8 +88,18 @@
             
          PWMout.period_ms(10);   
          PWMout.write(0.5f);   // Duty cycle  50% 
-          BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"Potential Occlusion to occur soon. Fistula health at xx%", CENTER_MODE);
-        wait(2.0);
+         
+    BSP_LCD_Clear(LCD_COLOR_WHITE);
+    BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
+    BSP_LCD_SetBackColor(LCD_COLOR_GRAY);
+    BSP_LCD_SetFont(&Font24);
+
+          BSP_LCD_DisplayStringAt(0, 50, (uint8_t *)"Potential Occlusion to occur soon. Fistula health at xx%", CENTER_MODE);
+        HAL_Delay(1000);
+         
+     pc.printf("%f \n\r",ADCdata);
+         printf(" 50percent Healthy Fistula \n");
+     
          }
          
          else if (ADCdata>= 0.85){
@@ -141,13 +110,17 @@
              PWMout.period_ms(10);   
              PWMout.write(0.9f);   // Duty cycle  90% 
              
-            BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"Abnormality detected: Please Consult Physician", CENTER_MODE);
-             wait(2.0);
+    BSP_LCD_Clear(LCD_COLOR_WHITE);
+    BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
+    BSP_LCD_SetBackColor(LCD_COLOR_GRAY);
+    BSP_LCD_SetFont(&Font24);
+
+            BSP_LCD_DisplayStringAt(0, 10, (uint8_t *)"Abnormality detected: Please Consult Physician", CENTER_MODE);
+             HAL_Delay(1000);
+               pc.printf("%f \n\r",ADCdata);
+             printf(" Abnormal Fistula \n");
+             
              }
-             else {
-        LCD_Feature++;
-        if (LCD_Feature == 1) {
-            LCD_Feature = 0;
-        }
+             
     }
-}}
+}