mirror of
https://github.com/ruvnet/RuView
synced 2026-08-10 20:31:42 +00:00
9744d367a2
The hardware side of ruview-gamma: an ESP32 driving an LED + audio flicker at
a commanded 36-44 Hz envelope with a hardware emergency stop. This is the
actuator the hil::verify_hil contract grades.
Split for testability:
- main/stim_core.{h,c}: pure C safety core, no ESP-IDF deps. Envelope
validation mirroring SafetyEnvelope::conservative(), a latched
START/STOP/e-stop state machine (a session can never silently resume after
an e-stop), exact integer timing in millihertz (the +/-0.1 Hz HIL target is
exact: 40.0 Hz = 40000 mHz -> 12500 us half-period), and a fail-closed line
parser. 15 host tests pass under gcc, no hardware needed.
- main/main.c: ESP-IDF binding. GPTimer ISR at 1 MHz crystal ticks, LEDC PWM
for LED (19.5 kHz carrier) and audio tone, sync-out GPIO for logic-analyzer
capture, e-stop GPIO ISR that turns outputs off in the ISR (microseconds,
vs the 100 ms HIL budget) then latches, USB-CDC line console.
Defense in depth: the device re-enforces the safety envelope independently of
the Rust host, so a buggy or compromised host cannot command an
out-of-envelope output. Emits a canonical integer SESSION {...} record per run
for witness-hash reproduction (HIL 100% reproducibility target).
Kconfig pins, 4 MB single-app, radio-off deterministic actuator profile.
Maps 1:1 to the five hil::verify_hil targets.
https://claude.ai/code/session_01MjBucx95K4BuUxZi8NWwRH
41 lines
1.2 KiB
Plaintext
41 lines
1.2 KiB
Plaintext
menu "Gamma Stimulation (ADR-250)"
|
|
|
|
config GAMMA_STIM_LED_GPIO
|
|
int "LED PWM output GPIO"
|
|
default 4
|
|
help
|
|
GPIO driving the LED MOSFET/driver. The 36-44 Hz stimulus is the
|
|
envelope on a 19.5 kHz PWM carrier.
|
|
|
|
config GAMMA_STIM_AUDIO_GPIO
|
|
int "Audio tone output GPIO"
|
|
default 5
|
|
help
|
|
GPIO driving the speaker/buzzer amplifier input (square tone,
|
|
envelope-gated). Use an analog volume stage for real loudness control.
|
|
|
|
config GAMMA_STIM_SYNC_GPIO
|
|
int "Sync-out GPIO (HIL measurement)"
|
|
default 6
|
|
help
|
|
Mirrors the stimulation envelope for photodiode/logic-analyzer
|
|
verification of the +/-0.1 Hz and <5 ms A/V sync HIL targets.
|
|
|
|
config GAMMA_STIM_ESTOP_GPIO
|
|
int "Emergency-stop button GPIO (active low)"
|
|
default 7
|
|
help
|
|
Button to GND. Falling edge latches an emergency stop: outputs off in
|
|
the ISR, sessions refused until UNLOCK. Stop latency target <100 ms;
|
|
the ISR path achieves microseconds.
|
|
|
|
config GAMMA_STIM_AUDIO_TONE_HZ
|
|
int "Audio tone carrier frequency (Hz)"
|
|
range 200 2000
|
|
default 440
|
|
help
|
|
The audible tone gated at the stimulation frequency. GENUS-style
|
|
protocols use a click/tone burst per cycle.
|
|
|
|
endmenu
|