添加人体门状态检测功能,包含初始化和读取状态的逻辑,并更新主程序以集成此功能

This commit is contained in:
Wang Beihong
2026-04-21 02:00:55 +08:00
parent cdc35d323a
commit 64c56fcca9
10 changed files with 140 additions and 41 deletions

View File

@@ -0,0 +1,26 @@
#pragma once
#include <stdbool.h>
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
#define HUMAN_SENSOR_GPIO 16
#define DOOR_SWITCH_GPIO 17
typedef struct {
bool human_present;
bool door_closed;
} human_door_state_t;
// GPIO16: HC-SR312. High means motion detected.
// GPIO17: Door switch. Low means door closed.
esp_err_t human_door_init(void);
esp_err_t human_door_read(human_door_state_t *out_state);
#ifdef __cplusplus
}
#endif