#ifndef INC_CP_H_
#define INC_CP_H_

#include "main.h"

typedef enum {
    EV_STATE_A_IDLE = 0,
    EV_STATE_B_CONN_PREP = 1,
    EV_STATE_C_CONN_ACTIVE = 2,
    EV_STATE_D_CONN_ACT_VENT = 3,
    EV_STATE_E_NO_POWER = 4,
    EV_STATE_F_ERROR = 5,
    EV_STATE_ACQUIRING = 6,
} CP_State_t;

typedef struct {
    uint32_t frequency_hz;
    uint8_t duty_percent;
    uint8_t valid;
} CP_Measurement_t;

extern volatile CP_State_t cp_state;

void CP_Init(void);
void CP_Task(void);
CP_Measurement_t CP_GetMeasurement(void);

#endif /* INC_CP_H_ */
