10#ifndef M5_UNIT_INFRARED_UNIT_AS312_HPP
11#define M5_UNIT_INFRARED_UNIT_AS312_HPP
13#include <M5UnitComponent.hpp>
26class UnitAS312 :
public Component {
27 M5_UNIT_COMPONENT_HPP_BUILDER(UnitAS312, 0x00);
58 bool begin()
override;
59 void update(
const bool force =
false)
override;
102 bool _prev_detected{};
103 bool _was_detected{};
104 bool _was_released{};
AS312 digital PIR motion sensor unit.
bool wasDetected() const
Rising edge detection.
Definition unit_AS312.hpp:75
void config(const config_t &cfg)
Set the config values.
Definition unit_AS312.hpp:53
config_t config() const
Gets the config values.
Definition unit_AS312.hpp:48
static constexpr uint32_t HOLD_TIME_MS
AS312 hold time in milliseconds (~2.3s)
Definition unit_AS312.hpp:31
bool readDetection(bool &detected)
Read the sensor pin state directly.
Definition unit_AS312.cpp:71
bool isDetected() const
Current detection state.
Definition unit_AS312.hpp:67
bool wasReleased() const
Falling edge detection.
Definition unit_AS312.hpp:83
Top level namespace of M5Stack.
Settings for begin.
Definition unit_AS312.hpp:37
uint32_t interval
Definition unit_AS312.hpp:40