This commit close this branch with WIP implementation of a stack based task pool system to handle long running action (motor move) of the kissStepper lib (that need a long `while`). The goal was to allow handling of incomming serrial messages and motion cancellation during stepper control loop.
29 lines
477 B
C++
29 lines
477 B
C++
#ifndef SERIAL_STREAM_H
|
|
#define SERIAL_STREAM_H
|
|
|
|
#include "HardwareSerial.h"
|
|
#include "turret.h"
|
|
|
|
class SerialStream {
|
|
public:
|
|
SerialStream();
|
|
~SerialStream();
|
|
|
|
SerialStream &connect(HardwareSerial &serial);
|
|
SerialStream &disconnect();
|
|
|
|
SerialStream &bind(Turret &turret);
|
|
SerialStream &unbind();
|
|
|
|
SerialStream &loop();
|
|
|
|
private:
|
|
// TEMP to keep this in mind
|
|
int _internal_buffer;
|
|
|
|
HardwareSerial *_serial = nullptr;
|
|
Turret *_turret = nullptr;
|
|
};
|
|
|
|
#endif
|