MiddleWare GUS
Sensors.h@3:d527bae62c60, 2015-12-10 (annotated)
- Committer:
- RoHe
- Date:
- Thu Dec 10 05:03:13 2015 +0000
- Revision:
- 3:d527bae62c60
- Parent:
- 1:fd355dc296b1
- Child:
- 4:a7da6ca6aef2
Update Program to count people.; Sensor.h and Sensors.cpp
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RoHe | 3:d527bae62c60 | 1 | #ifndef SENSORS_H_ |
RoHe | 3:d527bae62c60 | 2 | #define SENSORS_H_ |
RoHe | 3:d527bae62c60 | 3 | |
RoHe | 3:d527bae62c60 | 4 | |
RoHe | 1:fd355dc296b1 | 5 | #include "mbed.h" |
RoHe | 3:d527bae62c60 | 6 | #include "ultrasonic.h" |
RoHe | 1:fd355dc296b1 | 7 | |
RoHe | 1:fd355dc296b1 | 8 | /*Macros*/ |
RoHe | 1:fd355dc296b1 | 9 | #define BAD_PARAMETER (-1) |
RoHe | 1:fd355dc296b1 | 10 | #define OFF 0 |
RoHe | 1:fd355dc296b1 | 11 | #define ON 1 |
RoHe | 1:fd355dc296b1 | 12 | #define FALSE 0 |
RoHe | 1:fd355dc296b1 | 13 | #define TRUE 1 |
RoHe | 1:fd355dc296b1 | 14 | #define CLOSED 0 |
RoHe | 1:fd355dc296b1 | 15 | #define OPEN 1 |
RoHe | 3:d527bae62c60 | 16 | #define RANGE 500 |
RoHe | 1:fd355dc296b1 | 17 | |
RoHe | 1:fd355dc296b1 | 18 | |
RoHe | 3:d527bae62c60 | 19 | /*Function Initialization*/ |
RoHe | 3:d527bae62c60 | 20 | //START PIR SENSOR INPUT INIT |
RoHe | 3:d527bae62c60 | 21 | static DigitalIn PIR1(D0); |
RoHe | 3:d527bae62c60 | 22 | static DigitalIn PIR2(D1); |
RoHe | 3:d527bae62c60 | 23 | //END PIR SENSOR INPUT INIT |
RoHe | 3:d527bae62c60 | 24 | //START WINDOW SENSOR INPUT |
RoHe | 3:d527bae62c60 | 25 | static DigitalIn W1(D2); |
RoHe | 3:d527bae62c60 | 26 | static DigitalIn W2(D3); |
RoHe | 3:d527bae62c60 | 27 | static DigitalIn W3(D4); |
RoHe | 3:d527bae62c60 | 28 | //END WINDOW SENSOR INPUT INIT |
RoHe | 3:d527bae62c60 | 29 | //START DOOR SENSOR INPUT |
RoHe | 3:d527bae62c60 | 30 | static DigitalIn DOORSensor(D5); |
RoHe | 3:d527bae62c60 | 31 | //END DOOR SENSOR INPUT INIT |
RoHe | 3:d527bae62c60 | 32 | //START LIGHT CONTROL OUTPUT |
RoHe | 3:d527bae62c60 | 33 | static DigitalOut LightControl(D6); |
RoHe | 3:d527bae62c60 | 34 | //END LIGHT CONTROL OUTPUT |
RoHe | 3:d527bae62c60 | 35 | //START LIGHT FEEDBACK INPUT |
RoHe | 3:d527bae62c60 | 36 | static DigitalIn LIGHTSTATUS(D8); |
RoHe | 3:d527bae62c60 | 37 | //END LIGHT FEEDBACK INPUT |
RoHe | 3:d527bae62c60 | 38 | |
RoHe | 3:d527bae62c60 | 39 | static int PersonNumber; |
RoHe | 1:fd355dc296b1 | 40 | |
RoHe | 1:fd355dc296b1 | 41 | |
RoHe | 1:fd355dc296b1 | 42 | /*Extern Functions*/ |
RoHe | 1:fd355dc296b1 | 43 | //////////////////////////////////////////////////// |
RoHe | 1:fd355dc296b1 | 44 | extern bool GetPrescenceStatus(); |
RoHe | 1:fd355dc296b1 | 45 | /* GetPrescenceStatus: |
RoHe | 1:fd355dc296b1 | 46 | Input parameters -> void |
RoHe | 1:fd355dc296b1 | 47 | Output parameters -> bool RoomStatus; 0-> No Prescence Detected |
RoHe | 1:fd355dc296b1 | 48 | 1-> Prescence Detected |
RoHe | 1:fd355dc296b1 | 49 | */ |
RoHe | 1:fd355dc296b1 | 50 | |
RoHe | 1:fd355dc296b1 | 51 | //////////////////////////////////////////////////// |
RoHe | 1:fd355dc296b1 | 52 | extern bool GetDoorStatus(); |
RoHe | 1:fd355dc296b1 | 53 | /* GetDoorStatus: |
RoHe | 1:fd355dc296b1 | 54 | Input parameters -> void |
RoHe | 1:fd355dc296b1 | 55 | Output parameters -> bool DoorStatus; 0-> Door Closed |
RoHe | 1:fd355dc296b1 | 56 | 1-> Door Open |
RoHe | 1:fd355dc296b1 | 57 | */ |
RoHe | 1:fd355dc296b1 | 58 | |
RoHe | 1:fd355dc296b1 | 59 | //////////////////////////////////////////////////// |
RoHe | 1:fd355dc296b1 | 60 | extern int GetWindowStatus(int window); |
RoHe | 1:fd355dc296b1 | 61 | /* GetWindowStatus: |
RoHe | 1:fd355dc296b1 | 62 | Input parameters -> int window |
RoHe | 1:fd355dc296b1 | 63 | Output parameters -> int WindowStatus; -1-> Bad parameter or error |
RoHe | 1:fd355dc296b1 | 64 | 0-> Window Closed |
RoHe | 1:fd355dc296b1 | 65 | 1-> Window Open |
RoHe | 1:fd355dc296b1 | 66 | */ |
RoHe | 1:fd355dc296b1 | 67 | |
RoHe | 1:fd355dc296b1 | 68 | //////////////////////////////////////////////////// |
RoHe | 1:fd355dc296b1 | 69 | extern int SetLight(bool Light); |
RoHe | 1:fd355dc296b1 | 70 | /* SetLight: |
RoHe | 1:fd355dc296b1 | 71 | Input parameters -> bool Light; 0-> Light is OFF |
RoHe | 1:fd355dc296b1 | 72 | 1-> Light is ON |
RoHe | 1:fd355dc296b1 | 73 | |
RoHe | 1:fd355dc296b1 | 74 | Output parameters -> int WindowStatus; -1-> Bad parameter or error |
RoHe | 1:fd355dc296b1 | 75 | 0-> Light is OFF |
RoHe | 1:fd355dc296b1 | 76 | 1-> Light is ON |
RoHe | 1:fd355dc296b1 | 77 | */ |
RoHe | 1:fd355dc296b1 | 78 | |
RoHe | 1:fd355dc296b1 | 79 | //////////////////////////////////////////////////// |
RoHe | 1:fd355dc296b1 | 80 | extern unsigned int GetPersonStatus(); |
RoHe | 1:fd355dc296b1 | 81 | /* GetPersonStatus: |
RoHe | 1:fd355dc296b1 | 82 | Input parameters -> void |
RoHe | 1:fd355dc296b1 | 83 | |
RoHe | 1:fd355dc296b1 | 84 | Output parameters -> unsigned int PersonNumber; 0 - 4294967296. |
RoHe | 3:d527bae62c60 | 85 | */ |
RoHe | 3:d527bae62c60 | 86 | |
RoHe | 3:d527bae62c60 | 87 | //////////////////////////////////////////////////// |
RoHe | 3:d527bae62c60 | 88 | extern bool GetLightStatus(); |
RoHe | 3:d527bae62c60 | 89 | /* GetLightStatus: |
RoHe | 3:d527bae62c60 | 90 | Input parameters -> void |
RoHe | 3:d527bae62c60 | 91 | |
RoHe | 3:d527bae62c60 | 92 | Output parameters -> bool LightFeedback; 0-> Light is OFF |
RoHe | 3:d527bae62c60 | 93 | 1-> Light is ON |
RoHe | 3:d527bae62c60 | 94 | */ |
RoHe | 3:d527bae62c60 | 95 | |
RoHe | 3:d527bae62c60 | 96 | #endif |