#ifndef LAMP_DIAGNOSTIC_RUNTIME_H
#define LAMP_DIAGNOSTIC_RUNTIME_H
#include "pca9956b_async_bank.h"
#include "lamp_frame_stage.h"
typedef enum {LDR_UNINITIALIZED,LDR_RESET_HOLD,LDR_RESET_RECOVERY,LDR_READING,LDR_FAULT,LDR_CONFIGURING,LDR_FRAME_STAGING} lamp_diag_state;
/* Main-loop exclusive owner. Diagnostic and frame staging only; no physical LED permission. */
void lamp_diagnostic_runtime_init(uint32_t now);
void lamp_diagnostic_runtime_poll(uint32_t now);
lamp_diag_state lamp_diagnostic_runtime_state(void);
bool lamp_diagnostic_runtime_get(uint32_t now,pca_async_snapshot *out);
bool lamp_diagnostic_runtime_needs_poll(void);
/* g/p must remain alive and immutable except serialized guard updates until
 * staging completes. False while a diagnostic transaction/bank is incomplete.
 * Caller retries at the next completed bank; no hidden request queue. */
bool lamp_diagnostic_runtime_prepare_frame(const lg_guard *,const lamp_current_profile *,uint32_t now);
bool lamp_diagnostic_runtime_frame_ready(uint32_t now);
#endif
