AP mode
Dependencies: NetworkSocketAPI WizFi310Interface mbed
Fork of WizFi310_TCP_Echo_Server_Example by
detect.cpp@2:8d119e9b8f5a, 2017-10-02 (annotated)
- Committer:
- maru536
- Date:
- Mon Oct 02 20:48:08 2017 +0000
- Revision:
- 2:8d119e9b8f5a
- Child:
- 3:4b4eb90875bd
AP mode
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
maru536 | 2:8d119e9b8f5a | 1 | #include "detect.h" |
maru536 | 2:8d119e9b8f5a | 2 | #include "info.h" |
maru536 | 2:8d119e9b8f5a | 3 | #include "tts.h" |
maru536 | 2:8d119e9b8f5a | 4 | #include "push.h" |
maru536 | 2:8d119e9b8f5a | 5 | |
maru536 | 2:8d119e9b8f5a | 6 | I2C m_i2c(PA_10 , PA_09); |
maru536 | 2:8d119e9b8f5a | 7 | Timer m_timer; |
maru536 | 2:8d119e9b8f5a | 8 | |
maru536 | 2:8d119e9b8f5a | 9 | DetectHumanClass detect(PC_15, |
maru536 | 2:8d119e9b8f5a | 10 | PC_14, |
maru536 | 2:8d119e9b8f5a | 11 | &m_i2c, |
maru536 | 2:8d119e9b8f5a | 12 | &m_timer, |
maru536 | 2:8d119e9b8f5a | 13 | USBTX, |
maru536 | 2:8d119e9b8f5a | 14 | USBRX); |
maru536 | 2:8d119e9b8f5a | 15 | |
maru536 | 2:8d119e9b8f5a | 16 | void detecting(VS1053 *player, TCPSocket *socket, char* buf, char* id) |
maru536 | 2:8d119e9b8f5a | 17 | { |
maru536 | 2:8d119e9b8f5a | 18 | while(1) { |
maru536 | 2:8d119e9b8f5a | 19 | while(1) { |
maru536 | 2:8d119e9b8f5a | 20 | int sensor_state = detect.get_detect_state_(); |
maru536 | 2:8d119e9b8f5a | 21 | if(sensor_state == detect.POWER_ON) { |
maru536 | 2:8d119e9b8f5a | 22 | detect.SettingSensor(); |
maru536 | 2:8d119e9b8f5a | 23 | } else if(sensor_state == detect.SETTING_COMPLETE) { |
maru536 | 2:8d119e9b8f5a | 24 | detect.CalibrateSensor(); |
maru536 | 2:8d119e9b8f5a | 25 | } else if(sensor_state == detect.TOF_CALIBRATION_FIN) { |
maru536 | 2:8d119e9b8f5a | 26 | detect.DetectPIRState(); |
maru536 | 2:8d119e9b8f5a | 27 | } else if(sensor_state == detect.PIR_DETECTED) { |
maru536 | 2:8d119e9b8f5a | 28 | detect.DetectTOFState(); |
maru536 | 2:8d119e9b8f5a | 29 | } else if(sensor_state == detect.TOF_DETECTED) { |
maru536 | 2:8d119e9b8f5a | 30 | break; |
maru536 | 2:8d119e9b8f5a | 31 | } |
maru536 | 2:8d119e9b8f5a | 32 | } |
maru536 | 2:8d119e9b8f5a | 33 | detect.init(); |
maru536 | 2:8d119e9b8f5a | 34 | printf("detect!\n"); |
maru536 | 2:8d119e9b8f5a | 35 | |
maru536 | 2:8d119e9b8f5a | 36 | recvInfo(socket, buf, id); |
maru536 | 2:8d119e9b8f5a | 37 | playTTS(player, socket, buf); |
maru536 | 2:8d119e9b8f5a | 38 | requestNoti(socket, id, buf); |
maru536 | 2:8d119e9b8f5a | 39 | //((Thread*)args)->signal_set(DETECT_SIGNAL); |
maru536 | 2:8d119e9b8f5a | 40 | } |
maru536 | 2:8d119e9b8f5a | 41 | } |