Add human IR (PIR) module test on GPIO22 with SoftSPI touch and LVGL.

Motion-start count, hold bar, auto polarity, and flashable firmware/cyd package.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-23 14:46:56 +08:00
commit bab93d0e36
23 changed files with 1982 additions and 0 deletions

16
include/pir.h Normal file
View File

@@ -0,0 +1,16 @@
#pragma once
#include <stdint.h>
void pir_init();
/** 轮询:检测运动开始边沿,返回本周期是否有一次新感应 */
bool pir_poll_detect();
uint32_t pir_count();
void pir_reset_count();
bool pir_is_active();
/** 原始电平:1=HIGH,0=LOW */
int pir_raw_level();
/** 有人/运动时的有效电平(开机按空闲电平自动判定) */
int pir_active_level();
/** 当前连续有人时长 ms;空闲为 0 */
uint32_t pir_hold_ms();