#ifndef ENGINE_HPP_
#define ENGINE_HPP_

#include <atomic>
#include <thread>
#include "gpio.hpp"
#include "measure.hpp"

class engine
{
public:
	enum class direction
	{
		FORWARD,
		REVERSE
	};
private:
	std::atomic<int> speed;
	gpio pin_forward;
	gpio pin_reverse;
	std::atomic<bool> stop_thread;
	std::thread pwm_thread;
	measure measurement;
	void pwm_loop();
public:
	engine(gpio&& pin_forward, gpio&& pin_reverse);
	~engine();
	void set_speed(int speed);
};

#endif
