#ifndef DCCD_HW_H_
#define DCCD_HW_H_

/**** Includes ****/
#include <stdint.h>
#include "../bsp/board.h"
#include "../utils/vcounter.h"
#include "../hw/button.h"
#include "../hw/led_display.h"
#include "../hw/potentiometer.h"
#include "../hw/out_driver.h"
#include "../hw/safe_ain.h"

namespace dccd {

/**** Public definitions ****/
class DccdHw
{
	public:
	typedef struct {
		uint8_t pwm_f_khz;
		uint8_t handbrake_pull_up;
		uint8_t speed_hall;
	} dccdHwCfg_t;
		
	DccdHw(void);
	~DccdHw(void);
	
	void init(dccdHwCfg_t* cfg);
	
	// Inputs
	hw::SafeAin out_voltage;
	hw::SafeAin out_current;
	hw::SafeAin battery_voltage;
	hw::SafeAin battery_current;
	
	hw::Button btn_up;
	hw::Button btn_down;
	hw::Button btn_mode;
	hw::Button handbrake;
	hw::Button brakes;
	hw::Button dimm;
	
	hw::Potentiometer pot;
	
	// Outputs
	hw::LedDisplay display;
	hw::OutDriver outdriver;
	
	// Safety
	
	void read(void);
	
	#ifdef TESTING
	protected:
	#endif
	bsp::Board board_hw;
	util::VCounter counter;
};

/**** Public function declarations ****/

#ifdef TESTING
#endif

} //namespace

#endif /* DCCD_HW_H_ */