AP mode
Dependencies: NetworkSocketAPI WizFi310Interface mbed
Fork of WizFi310_TCP_Echo_Server_Example by
DetectHumanClass/DetectHumanClass.h@2:8d119e9b8f5a, 2017-10-02 (annotated)
- Committer:
- maru536
- Date:
- Mon Oct 02 20:48:08 2017 +0000
- Revision:
- 2:8d119e9b8f5a
AP mode
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
maru536 | 2:8d119e9b8f5a | 1 | #ifndef DETECTHUMANCLASS_H |
maru536 | 2:8d119e9b8f5a | 2 | #define DETECTHUMANCLASS_H |
maru536 | 2:8d119e9b8f5a | 3 | |
maru536 | 2:8d119e9b8f5a | 4 | #include "mbed.h" |
maru536 | 2:8d119e9b8f5a | 5 | #include "VL53L0X.h" |
maru536 | 2:8d119e9b8f5a | 6 | |
maru536 | 2:8d119e9b8f5a | 7 | |
maru536 | 2:8d119e9b8f5a | 8 | class DetectHumanClass |
maru536 | 2:8d119e9b8f5a | 9 | { |
maru536 | 2:8d119e9b8f5a | 10 | public: |
maru536 | 2:8d119e9b8f5a | 11 | enum SensorState { |
maru536 | 2:8d119e9b8f5a | 12 | POWER_ON = 0, |
maru536 | 2:8d119e9b8f5a | 13 | SETTING_COMPLETE = 1, |
maru536 | 2:8d119e9b8f5a | 14 | TOF_CALIBRATION_FIN = 2, |
maru536 | 2:8d119e9b8f5a | 15 | PIR_DETECTED = 3, |
maru536 | 2:8d119e9b8f5a | 16 | TOF_DETECTED = 4 |
maru536 | 2:8d119e9b8f5a | 17 | }; |
maru536 | 2:8d119e9b8f5a | 18 | |
maru536 | 2:8d119e9b8f5a | 19 | enum Threshold { |
maru536 | 2:8d119e9b8f5a | 20 | MIN_TOF_THRESHOLD = 0, |
maru536 | 2:8d119e9b8f5a | 21 | MAX_TOF_THRESHOLD = 2000 |
maru536 | 2:8d119e9b8f5a | 22 | }; |
maru536 | 2:8d119e9b8f5a | 23 | |
maru536 | 2:8d119e9b8f5a | 24 | DetectHumanClass(PinName pir_a_port, |
maru536 | 2:8d119e9b8f5a | 25 | PinName pir_b_port, |
maru536 | 2:8d119e9b8f5a | 26 | I2C*, |
maru536 | 2:8d119e9b8f5a | 27 | Timer*, |
maru536 | 2:8d119e9b8f5a | 28 | PinName tx, |
maru536 | 2:8d119e9b8f5a | 29 | PinName rx);//constructor |
maru536 | 2:8d119e9b8f5a | 30 | |
maru536 | 2:8d119e9b8f5a | 31 | |
maru536 | 2:8d119e9b8f5a | 32 | bool SettingSensor();//declare in/out port |
maru536 | 2:8d119e9b8f5a | 33 | bool CalibrateSensor();//calibration TOF sensor |
maru536 | 2:8d119e9b8f5a | 34 | bool DetectPIRState();//Detecting pir sensor |
maru536 | 2:8d119e9b8f5a | 35 | int get_detect_state_();//for using main logic |
maru536 | 2:8d119e9b8f5a | 36 | int init();//for using main logic |
maru536 | 2:8d119e9b8f5a | 37 | bool DetectTOFState();//if detectPIRstate return true, activating TOF sensor |
maru536 | 2:8d119e9b8f5a | 38 | |
maru536 | 2:8d119e9b8f5a | 39 | int detect_sensor_state_ ;//detect_stata variables mattching the SensorState enum |
maru536 | 2:8d119e9b8f5a | 40 | uint16_t calibrationed_distance; |
maru536 | 2:8d119e9b8f5a | 41 | |
maru536 | 2:8d119e9b8f5a | 42 | |
maru536 | 2:8d119e9b8f5a | 43 | |
maru536 | 2:8d119e9b8f5a | 44 | |
maru536 | 2:8d119e9b8f5a | 45 | private: |
maru536 | 2:8d119e9b8f5a | 46 | DigitalIn pir_a_pin_; |
maru536 | 2:8d119e9b8f5a | 47 | DigitalIn pir_b_pin_; |
maru536 | 2:8d119e9b8f5a | 48 | Serial pc; |
maru536 | 2:8d119e9b8f5a | 49 | VL53L0X tof_; |
maru536 | 2:8d119e9b8f5a | 50 | I2C* i2c; |
maru536 | 2:8d119e9b8f5a | 51 | Timer* timer; |
maru536 | 2:8d119e9b8f5a | 52 | }; |
maru536 | 2:8d119e9b8f5a | 53 | |
maru536 | 2:8d119e9b8f5a | 54 | #endif |