/* * 文件: components/human_door/include/human_door.h * 角色: 人体/门磁输入采集 * 说明: * - 本文件用于实现当前模块的核心功能或接口定义。 * - 修改前请先确认该模块与其它任务/外设之间的数据流关系。 * - 涉及协议与硬件时,优先保持现有接口兼容,避免联调回归。 */ #pragma once #include #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