AP mode
Dependencies: NetworkSocketAPI WizFi310Interface mbed
Fork of WizFi310_TCP_Echo_Server_Example by
Diff: detect.cpp
- Revision:
- 2:8d119e9b8f5a
- Child:
- 3:4b4eb90875bd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/detect.cpp Mon Oct 02 20:48:08 2017 +0000 @@ -0,0 +1,41 @@ +#include "detect.h" +#include "info.h" +#include "tts.h" +#include "push.h" + +I2C m_i2c(PA_10 , PA_09); +Timer m_timer; + +DetectHumanClass detect(PC_15, + PC_14, + &m_i2c, + &m_timer, + USBTX, + USBRX); + +void detecting(VS1053 *player, TCPSocket *socket, char* buf, char* id) +{ + while(1) { + while(1) { + int sensor_state = detect.get_detect_state_(); + if(sensor_state == detect.POWER_ON) { + detect.SettingSensor(); + } else if(sensor_state == detect.SETTING_COMPLETE) { + detect.CalibrateSensor(); + } else if(sensor_state == detect.TOF_CALIBRATION_FIN) { + detect.DetectPIRState(); + } else if(sensor_state == detect.PIR_DETECTED) { + detect.DetectTOFState(); + } else if(sensor_state == detect.TOF_DETECTED) { + break; + } + } + detect.init(); + printf("detect!\n"); + + recvInfo(socket, buf, id); + playTTS(player, socket, buf); + requestNoti(socket, id, buf); + //((Thread*)args)->signal_set(DETECT_SIGNAL); + } +} \ No newline at end of file