This commit is contained in:
2017-06-28 20:40:01 +02:00
parent 76dd61f48b
commit 8d2b664149
41 changed files with 5225 additions and 0 deletions

31
kawaii/engine.hpp Normal file
View File

@@ -0,0 +1,31 @@
#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