Abgabe
This commit is contained in:
31
kawaii/engine.hpp
Normal file
31
kawaii/engine.hpp
Normal 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
|
||||
Reference in New Issue
Block a user