|
ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
|
RCWL-0516 microwave Doppler presence sensor, and the shared one-GPIO presence facade (PC_ENABLE_RCWL0516). More...
#include "protocore_config.h"Go to the source code of this file.
RCWL-0516 microwave Doppler presence sensor, and the shared one-GPIO presence facade (PC_ENABLE_RCWL0516).
The RCWL-0516 (RCWL-9196 controller + MMBR941M RF amp, ~3.18 GHz Doppler) has no data protocol at all: a single 3.3 V OUT pin that latches HIGH when a moving reflector is detected and returns LOW once its own retrigger window expires. Everything interesting is therefore in time, not in bytes - which is what this module provides.
Two problems a bare digitalRead() does not solve, and this does:
The core is pure and takes an explicit now, exactly like services/hotswap: it decides, the binding acts. That makes the whole machine host-testable by injecting pin levels against a synthetic clock, with no GPIO and no real time involved. All timing comparisons are unsigned differences, so they are wrap-safe across a millis() rollover.
PresenceCore is deliberately sensor-agnostic: it is a debounced, hold-extended view of one active-high presence pin. The RCWL-0516 is simply its first user, via the pc_rcwl0516_core_init defaults - the HMMD's OUT pin, a PIR, or an HB100 can reuse the same core by supplying their own two constants.
Fail-safe start: a freshly initialized core reports absent and treats the pin as idle, so presence is only ever reported after it has actually been observed and believed. Claiming presence you have not yet measured is the failure mode worth avoiding.
Definition in file rcwl0516.h.