35 lines
544 B
C++
35 lines
544 B
C++
#ifndef STATE_H
|
|
#define STATE_H
|
|
|
|
#include "node_types.h"
|
|
|
|
class MotorController;
|
|
|
|
class State
|
|
{
|
|
protected:
|
|
MotorController* context = nullptr;
|
|
|
|
public:
|
|
virtual ~State()
|
|
{
|
|
}
|
|
|
|
void set_context(MotorController* context)
|
|
{
|
|
this->context = context;
|
|
}
|
|
|
|
virtual void enter() = 0; // LED ON
|
|
|
|
virtual void update() = 0; // run motor controller
|
|
|
|
// virtual void command(char c) = 0; // Listen for reset
|
|
|
|
virtual void exit() = 0; // Stop motor
|
|
|
|
virtual NodeState id() const = 0; //
|
|
};
|
|
|
|
#endif
|