mirror of
https://github.com/ruvnet/RuView
synced 2026-07-24 17:43:20 +00:00
948768bdda
ADR-110 P9 — software-only unblocks for the WITNESS-LOG-110 §B
hardware-blocked items. Two new modules, both default-off so v0.6.6 fleets
see no behavior change.
LP-core (B4 path):
- New firmware/esp32-csi-node/main/lp_core/main.c: real RISC-V LP-core
motion-gate program with debounce + monotonic motion_count counter.
- c6_lp_core.c rewritten to load + run the LP binary via ulp_lp_core_run
when CONFIG_C6_LP_CORE_ENABLE=y; falls back to the v0.6.6 ext1 GPIO-wake
path otherwise (keeps regression surface small).
- ulp_embed_binary() wired in main/CMakeLists.txt, gated on the Kconfig.
- New Kconfig knobs: C6_LP_POLL_PERIOD_US (default 10 ms),
C6_LP_DEBOUNCE_SAMPLES (default 3).
- Exposes c6_lp_core_motion_count() / c6_lp_core_poll_count() for the
witness harness — once an INA/Joulescope is on the bench, B4 is one
capture away from a measured number.
Soft-AP HE (B1/B2 unblock):
- New c6_softap_he.{h,c}: brings up the C6 in AP+STA mode with WPA2-PSK
+ HE advertisement, so a second C6 in STA mode can negotiate real
iTWT against a known-cooperative AP without buying an 11ax router.
- main.c calls c6_softap_he_start() right before esp_wifi_start() when
CONFIG_C6_SOFTAP_HE_ENABLE=y.
- New Kconfig knobs: C6_SOFTAP_HE_{SSID,PSK,CHANNEL} with NVS overrides
via softap_ssid / softap_psk / softap_chan in the ruview namespace.
Build artifacts (IDF v5.4, both green, RC=0):
- S3 8 MB: 1093 KB (47% partition slack)
- C6 4 MB: 1019 KB (45% partition slack)
- SHA-256 sums in dist/firmware-v0.6.7/SHA256SUMS.txt
Doc updates: CHANGELOG wave-3 entry, ADR-110 phase table gets P5
upgrade note + new P9 row, WITNESS-LOG-110 gets new A0 section
recording the v0.6.7 build evidence.
Co-Authored-By: claude-flow <ruv@ruv.net>
78 lines
2.3 KiB
C
78 lines
2.3 KiB
C
/**
|
|
* @file c6_lp_core.h
|
|
* @brief LP-core wake-on-motion hibernation helper — ADR-110 Phase 5.
|
|
*
|
|
* Arms the C6 LP RISC-V coprocessor as an always-on watchdog that
|
|
* monitors a GPIO (typically a PIR or accelerometer interrupt line) and
|
|
* wakes the HP core only when motion is detected. Targets ~5 µA
|
|
* hibernation current for battery-powered Cognitum Seed nodes.
|
|
*
|
|
* Only built when CONFIG_IDF_TARGET_ESP32C6 + CONFIG_ULP_COPROC_TYPE_LP_CORE.
|
|
*
|
|
* P5 skeleton: the LP-core program is shipped as inline C compiled into
|
|
* the main image. A follow-up turn migrates it to a separate
|
|
* lp_core/main.c subproject with its own CMake.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "esp_err.h"
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#if defined(CONFIG_IDF_TARGET_ESP32C6) && defined(CONFIG_ULP_COPROC_TYPE_LP_CORE)
|
|
|
|
/**
|
|
* Configure the LP-core wake-on-motion watcher.
|
|
*
|
|
* @param wake_gpio GPIO pin to monitor (must be an RTC/LP-domain GPIO).
|
|
* @param active_high true = wake on rising edge, false = falling.
|
|
* @return ESP_OK on success.
|
|
*/
|
|
esp_err_t c6_lp_core_arm(int wake_gpio, bool active_high);
|
|
|
|
/**
|
|
* Enter deep sleep with the LP-core armed as the wake source. Does not
|
|
* return — the next boot will see ESP_SLEEP_WAKEUP_LP_CORE in
|
|
* esp_sleep_get_wakeup_cause().
|
|
*/
|
|
void c6_lp_core_hibernate_and_wait(void);
|
|
|
|
/**
|
|
* Returns true if the most recent boot was a wake from LP-core motion
|
|
* detection (vs a cold boot or different wake source).
|
|
*/
|
|
bool c6_lp_core_was_motion_wake(void);
|
|
|
|
/**
|
|
* Monotonic counter of wake-triggering motion events observed by the
|
|
* LP-core program since the last cold boot. Returns 0 when
|
|
* CONFIG_C6_LP_CORE_ENABLE is unset (fallback path).
|
|
*/
|
|
uint32_t c6_lp_core_motion_count(void);
|
|
|
|
/**
|
|
* Total LP-timer poll iterations executed by the LP-core program.
|
|
* Useful as a sanity check that the LP-core is actually running;
|
|
* returns 0 on the fallback path.
|
|
*/
|
|
uint32_t c6_lp_core_poll_count(void);
|
|
|
|
#else
|
|
|
|
static inline esp_err_t c6_lp_core_arm(int g, bool h) { (void)g; (void)h; return ESP_OK; }
|
|
static inline void c6_lp_core_hibernate_and_wait(void) { }
|
|
static inline bool c6_lp_core_was_motion_wake(void) { return false; }
|
|
static inline uint32_t c6_lp_core_motion_count(void) { return 0; }
|
|
static inline uint32_t c6_lp_core_poll_count(void) { return 0; }
|
|
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|