#ifndef FRONT_PANEL_H_
#define FRONT_PANEL_H_

#include <Encoder.h>

#include "Wire.h"

class C_FrontPanel {
   public:
    C_FrontPanel() : frontEnc(3, 2) {
        ;
    }

    void Init();
    void Tasks();

    void SetLed(int ledIndex, bool state);
    bool IsLedOn(int ledIndex);
    bool IsButtonDown(int btnIndex);
    int GetEncoderPos();
    bool IsEncoderButtonDown();

   private:
    Encoder frontEnc;
    uint8_t mcp_portVal;
    int encPos = 0;

    static const uint8_t MCP_ADDRESS = 0x20;
    static const uint8_t MCP_REG_IODIR = 0x00;
    static const uint8_t MCP_REG_IPOL = 0x01;
    static const uint8_t MCP_REG_GPINTEN = 0x02;
    static const uint8_t MCP_REG_DEFVAL = 0x03;
    static const uint8_t MCP_REG_INTCON = 0x04;
    static const uint8_t MCP_REG_IOCON = 0x05;
    static const uint8_t MCP_REG_GPPU = 0x06;
    static const uint8_t MCP_REG_INTF = 0x07;
    static const uint8_t MCP_REG_INTCAP = 0x08;
    static const uint8_t MCP_REG_GPIO = 0x09;
    static const uint8_t MCP_REG_OLAT = 0x0A;
};

#endif