main
John Lauer Publish assumption-based R11 assembly study, locked firmware and new review footage d61d6cb
#ifndef ADOM_FAN_TACH_H
#define ADOM_FAN_TACH_H
#include <stdbool.h>
#include <stdint.h>
typedef struct { uint32_t last_edge_us, periods_us[8]; unsigned count, next; bool seen; } fan_tach;
void fan_tach_init(fan_tach *f);
/* Valid RPM is telemetry, not authorization to enable the load.
 * 2 pulses/revolution; 500..12000 RPM accepted for measurement. */
/* Call for rising edges only from a microsecond timer. Snapshot atomically outside ISR. */
void fan_tach_edge(fan_tach *f, uint32_t now_us);
/* Poll regularly (well before the 32-bit timer wraps) to discard stale history.
 * Serialize with fan_tach_edge when used by an interrupt. */
void fan_tach_expire(fan_tach *f, uint32_t now_us);
bool fan_tach_read(const fan_tach *f, uint32_t now_us, float *rpm);
#endif