#ifndef PILOT_H_
#define PILOT_H_

#ifdef __cplusplus
extern "C"
{
#endif

#include <stdbool.h>
#include <stdint.h>

    typedef enum
    {
        PILOT_VOLTAGE_12,
        PILOT_VOLTAGE_9,
        PILOT_VOLTAGE_6,
        PILOT_VOLTAGE_3,
        PILOT_VOLTAGE_1
    } pilot_voltage_t;

    void pilot_init(void);

    /**
     * @brief Define o pilot em modo DC.
     *
     * @param high true = nível alto (+12V)
     *             false = nível baixo (-12V)
     */
    void pilot_set_level(bool high);

    void pilot_set_amps(uint16_t amps);

    void pilot_measure(pilot_voltage_t *up_voltage, bool *down_voltage_n12);

    bool pilot_get_state(void);

    typedef struct
    {
        uint16_t high_mv;
        uint16_t low_mv;
    } pilot_voltage_cache_t;

#ifdef __cplusplus
}
#endif

#endif /* PILOT_H_ */
