27 lines
458 B
C
27 lines
458 B
C
#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
|