stan projektu 20 maja

Dependencies:   mbed LCD_DISCO_F469NI TS_DISCO_F469NI F469_GUI BSP_DISCO_F469NI

Revision:
1:5a6352364c9c
Parent:
0:0da7047bbb6e
--- a/main.cpp	Mon May 20 09:16:38 2019 +0000
+++ b/main.cpp	Mon May 20 10:00:25 2019 +0000
@@ -3,6 +3,9 @@
 #include <string>
 #include <sstream>
 #include <stdio.h>
+#include "F469_GUI.hpp"
+#include "stm32469i_discovery.h"
+#include "TS_DISCO_F469NI.h"
 
 LCD_DISCO_F469NI lcd;
 
@@ -12,6 +15,9 @@
 
 int main()
 {    
+    Button button1(20, 60, 200, 70, "Pomiar jednorazowy");
+    Button button2(20, 150, 200, 70, "Pomiar okresowy");
+    Button button3(20, 240, 200, 70, "Pomiar testowy");
     lcd.SetBackColor(LCD_COLOR_BLUE);
     lcd.SetTextColor(LCD_COLOR_WHITE);
     uint8_t text[30];
@@ -21,19 +27,27 @@
   
     while(1)
     {
-                   
-    meas = analog_value.read(); 
-    meas = meas * 3300;
+    if (button1.Touched()){
+         button2.Draw();
+         
+         meas = analog_value.read(); 
+         meas = meas * 3300;
      
-    led1 = 0;
-    lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"Nie ma wody", CENTER_MODE);
+         led1 = 0;
+        lcd.DisplayStringAt(0, LINE(12), (uint8_t *)"Nie ma wody", CENTER_MODE);
  
-    if(meas<2000){
-        lcd.Clear(LCD_COLOR_BLUE);
-        led1 = 1;
-        lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"Jest woda", CENTER_MODE);
+            if(meas<2000){
+                led1 = 1;
+                 lcd.DisplayStringAt(0, LINE(12), (uint8_t *)"Jest woda", CENTER_MODE);
 
-    } 
+                 } 
+        sprintf((char*)text, "Pomiar: %f", meas);
+        lcd.DisplayStringAt(0, LINE(8), (uint8_t *)&text, CENTER_MODE);
+         
+         }
+    if (button2.Touched()) button1.Draw();
+                   
+  
     //string a = tostr(meas);
     //char buffer [10];
     //sprintf (buffer, "%6.2f",meas);// datastream value
@@ -41,8 +55,6 @@
     //lcd.Clear(LCD_COLOR_BLUE);
 
     //lcd.DisplayStringAt(0, LINE(10),(uint8_t *)"%6.2f",meas , CENTER_MODE);
-    sprintf((char*)text, "Pomiar: %f", meas);
-        lcd.DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE);
 
     //sprintf((char*)text, "Touches: 0");
     //lcd.DisplayStringAt(0, LINE(0), (uint8_t *)&text, LEFT_MODE);