#ifndef PRESSURE_AGE_H
#define PRESSURE_AGE_H
#include "pressure_decode.h"
/* Host-read age only; does not prove sensor conversion freshness or fan permission.
   Call tick at least once per 2^31 ms. Consumers must also check elapsed time. */
typedef enum { PV_EMPTY, PV_ACQUIRING, PV_RECENT_READ, PV_EXPIRED,
               PV_BAD_RESULT, PV_READ_TIMEOUT, PV_CONFIG_ERROR } pv_status;
typedef struct {
 xp_result result;
 uint32_t started_ms, finished_ms, max_age_ms, max_read_ms;
 pv_status status;
} pv_state;
bool pv_init(pv_state *,uint32_t max_age_ms,uint32_t max_read_ms);
void pv_begin(pv_state *,uint32_t now_ms);
void pv_complete(pv_state *,const xp_result *,uint32_t now_ms);
bool pv_tick(pv_state *,uint32_t now_ms);
#endif
