no description

Fork of Middleware by Roberto Herrera

Revision:
0:d1ff330c5128
diff -r 000000000000 -r d1ff330c5128 SensorPIR.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SensorPIR.cpp	Sat Dec 05 17:43:29 2015 +0000
@@ -0,0 +1,85 @@
+/*
+
+Drivers.cpp
+
+Only to improve the clarity of main .cpp
+This don't have any new classes
+
+All the multiple task are here 
+for Smart Room project asked by 
+Gustavo Torres 
+
+Last update by RoHe 16/11/2015
+
+*/
+
+#include "SensorPIR.h"
+
+Drivers::Drivers()
+{
+    varInt=5;
+}
+
+bool Drivers::is_good(void)
+{
+    return true;
+}
+
+int Drivers::getVar(void)
+{
+    return varInt;
+}
+
+char* Drivers::echo(void)
+{
+    return "Hello from Library";
+}
+ 
+/*Defines*/
+//Serial UARTPIR(USBTX, USBRX);
+//DigitalOut dout(LED1);
+//DigitalIn enable2(D1);
+//DigitalIn enable3(D2);
+//DigitalIn enable4(D3);
+ 
+/*Functions*/
+int GetPersonStatus(int RoomPrescence) {
+    bool print = 0;
+    bool RoomStatus = 0;   
+    wait(2); //Wait for sensor to take snap shot of still room
+    
+    switch(RoomPrescence)
+    {
+      case 1:
+            if(enable1==1 /*|| enable2==1 || enable3==1 || enable4==1*/)
+            {
+                RoomStatus = 1;
+                ledGREEN=1;
+                if(print == 0)
+                {
+                    pc.printf("Presencia detectada\n\r");
+                    print = 1;
+                }
+            }
+            else
+            {
+                RoomStatus = 0;
+                ledGREEN=0;
+                if(print == 1)
+                {
+                    pc.printf("Ninguna presencia detectada\n\r");
+                    print = 0;
+                }
+            }
+            break;
+            
+        case 2:
+        /*ADD NEW ROOM*/
+            break;
+            
+        default:
+        /*Do Nothing*/
+            break;
+    }
+    return RoomStatus;
+}
\ No newline at end of file