|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
DFRobot SEN0192 10.525 GHz microwave Doppler motion sensor (PROTOCORE_ENABLE_SEN0192). More...
#include "protocore_config.h"Go to the source code of this file.
Classes | |
| struct | Sen0192Motion |
| Debounced motion-presence tracker over a single digital line. More... | |
| struct | Sen0192Ns |
| Dispatch table. Addressed by offset, so the layout is asserted below. More... | |
Functions | |
| PROTOCORE_NS_LAYOUT (Sen0192Ns, motion_init, motion_update, motion_tick, motion_present, motion_events, motion_active_age_ms, begin, poll, present, motion_count) | |
| void | protocore_sen0192_motion_init (uint8_t *work, Sen0192Motion *m, uint32_t hold_ms, proto_bool active_high) |
| Initialize a tracker: active_high sets the motion polarity, hold_ms . | |
| proto_bool | protocore_sen0192_motion_update (uint8_t *work, Sen0192Motion *m, proto_bool level_high, uint32_t now_ms) |
| Feed one sampled line level at now_ms. | |
| proto_bool | protocore_sen0192_motion_tick (uint8_t *work, Sen0192Motion *m, uint32_t now_ms) |
| Re-evaluate presence against the hold window at now_ms without a . | |
| proto_bool | protocore_sen0192_motion_present (uint8_t *work, const Sen0192Motion *m) |
| Current presence (respecting the hold window). | |
| uint32_t | protocore_sen0192_motion_events (uint8_t *work, const Sen0192Motion *m) |
| Number of clear -> present transitions since init. | |
| uint32_t | protocore_sen0192_motion_active_age_ms (uint8_t *work, const Sen0192Motion *m, uint32_t now_ms) |
| Milliseconds since the last active-level sample (0 if none yet). | |
| proto_bool | protocore_sen0192_begin (uint8_t *work) |
| Configure PROTOCORE_SEN0192_PIN as an input and start tracking . | |
| proto_bool | protocore_sen0192_poll (uint8_t *work) |
| Sample the pin now (via protocore_millis()). true iff a new . | |
| void | protocore_sen0192_present (uint8_t *work) |
| Current presence. | |
| void | protocore_sen0192_motion_count (uint8_t *work) |
| Count of motion events (clear -> present transitions) since . | |
| uint8_t * | protocore_sen0192_span (void) |
| The PROTOCORE_SEN0192_BORROW bytes this module's state lives in. | |
Variables | |
| PROTOCORE_NS Sen0192Ns Sen0192 | PROTOCORE_UNUSED |
| Module namespace. | |
DFRobot SEN0192 10.525 GHz microwave Doppler motion sensor (PROTOCORE_ENABLE_SEN0192).
The SEN0192 is a 3-pin part (V / G / digital OUT) whose OUT line asserts while it senses motion (Doppler shift) within its adjustable range. Unlike the framed serial of an LD2410, it carries no protocol - it is a single digital line - so the "driver" is a debounced presence tracker over that line: assert presence on an active sample and hold it for a configurable window after the last active sample, so brief gaps between Doppler returns don't make presence flap.
The presence state machine (Sen0192Motion) is pure and host-tested - it takes a sampled line level and a timestamp and needs no clock or GPIO. The binding reads PROTOCORE_SEN0192_PIN each poll (via protocore_millis()) and feeds it in; only that read reaches the pin seam. The OUT polarity and hold window come from ServerConfig (PROTOCORE_SEN0192_ACTIVE_HIGH / PROTOCORE_SEN0192_HOLD_MS / PROTOCORE_SEN0192_PIN).
work is PROTOCORE_SEN0192_BORROW bytes the CALLER took, at an address it knows. It is not held past the call, so nothing here aliases it. How those bytes are carved is this module's and is never named here.
Definition in file sen0192.h.
| PROTOCORE_NS_LAYOUT | ( | Sen0192Ns | , |
| motion_init | , | ||
| motion_update | , | ||
| motion_tick | , | ||
| motion_present | , | ||
| motion_events | , | ||
| motion_active_age_ms | , | ||
| begin | , | ||
| poll | , | ||
| present | , | ||
| motion_count | |||
| ) |
| void protocore_sen0192_motion_init | ( | uint8_t * | work, |
| Sen0192Motion * | m, | ||
| uint32_t | hold_ms, | ||
| proto_bool | active_high | ||
| ) |
Initialize a tracker: active_high sets the motion polarity, hold_ms .
| work | PROTOCORE_SEN0192_BORROW bytes the caller took. Not held past the call. |
| m | M |
| hold_ms | Hold ms |
| active_high | Active high |
| proto_bool protocore_sen0192_motion_update | ( | uint8_t * | work, |
| Sen0192Motion * | m, | ||
| proto_bool | level_high, | ||
| uint32_t | now_ms | ||
| ) |
Feed one sampled line level at now_ms.
| work | PROTOCORE_SEN0192_BORROW bytes the caller took. Not held past the call. |
| m | M |
| level_high | Level high |
| now_ms | Now ms |
| proto_bool protocore_sen0192_motion_tick | ( | uint8_t * | work, |
| Sen0192Motion * | m, | ||
| uint32_t | now_ms | ||
| ) |
Re-evaluate presence against the hold window at now_ms without a .
| work | PROTOCORE_SEN0192_BORROW bytes the caller took. Not held past the call. |
| m | M |
| now_ms | Now ms |
| proto_bool protocore_sen0192_motion_present | ( | uint8_t * | work, |
| const Sen0192Motion * | m | ||
| ) |
Current presence (respecting the hold window).
| work | PROTOCORE_SEN0192_BORROW bytes the caller took. Not held past the call. |
| m | M |
| uint32_t protocore_sen0192_motion_events | ( | uint8_t * | work, |
| const Sen0192Motion * | m | ||
| ) |
Number of clear -> present transitions since init.
| work | PROTOCORE_SEN0192_BORROW bytes the caller took. Not held past the call. |
| m | M |
| uint32_t protocore_sen0192_motion_active_age_ms | ( | uint8_t * | work, |
| const Sen0192Motion * | m, | ||
| uint32_t | now_ms | ||
| ) |
Milliseconds since the last active-level sample (0 if none yet).
| work | PROTOCORE_SEN0192_BORROW bytes the caller took. Not held past the call. |
| m | M |
| now_ms | Now ms |
| proto_bool protocore_sen0192_begin | ( | uint8_t * | work | ) |
Configure PROTOCORE_SEN0192_PIN as an input and start tracking .
| work | PROTOCORE_SEN0192_BORROW bytes the caller took. Not held past the call. |
| proto_bool protocore_sen0192_poll | ( | uint8_t * | work | ) |
Sample the pin now (via protocore_millis()). true iff a new .
| work | PROTOCORE_SEN0192_BORROW bytes the caller took. Not held past the call. |
| void protocore_sen0192_present | ( | uint8_t * | work | ) |
Current presence.
| work | PROTOCORE_SEN0192_BORROW bytes the caller took. Not held past the call. |
| void protocore_sen0192_motion_count | ( | uint8_t * | work | ) |
Count of motion events (clear -> present transitions) since .
| work | PROTOCORE_SEN0192_BORROW bytes the caller took. Not held past the call. |
| uint8_t * protocore_sen0192_span | ( | void | ) |
The PROTOCORE_SEN0192_BORROW bytes this module's state lives in.
Stated beside the namespace rather than on it: an entry takes a borrow, and this is where that borrow comes from. Taken once from the end of the pool, which no mark and no release walks, so the state lasts the life of the program.
| PROTOCORE_NS Sen0192Ns Sen0192 PROTOCORE_UNUSED |
Module namespace.