From b426091958335a424a5dcbb6b6ea2527d9fa9edf Mon Sep 17 00:00:00 2001 From: Arthur Wolf Date: Sat, 6 Jul 2013 16:46:33 +0200 Subject: [PATCH] forgot Actuator.h --- src/libs/actuators/Actuator.h | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/libs/actuators/Actuator.h diff --git a/src/libs/actuators/Actuator.h b/src/libs/actuators/Actuator.h new file mode 100644 index 00000000..69a758b9 --- /dev/null +++ b/src/libs/actuators/Actuator.h @@ -0,0 +1,55 @@ +/* + This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl). + Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + You should have received a copy of the GNU General Public License along with Smoothie. If not, see . +*/ + +#ifndef ACTUATOR_H +#define ACTUATOR_H + +#include "libs/Hook.h" + +/* Actuator is the base class for all actuator-type things ( StepperMotors, ServoMotors etc ). */ + +class Actuator { + public: + Actuator(){}; + + /* Functions all actuators must have are still to be defined, but here are a few bellow for a start */ + void tick(); + void step(); + void move_finished(); + void move( bool direction, unsigned int steps ); + void signal_move_finished(); + void set_speed( double speed ); + void update_exit_tick(); + void pause(); + void unpause(); + + template void attach( t *optr, uint32_t ( t::*fptr )( uint32_t ) ){ + Hook* hook = new Hook(); + hook->attach(optr, fptr); + this->end_hook = hook; + } + + template void attach_signal_step(uint32_t step, t *optr, uint32_t ( t::*fptr )( uint32_t ) ){ + this->step_signal_hook->attach(optr, fptr); + this->signal_step_number = step; + this->signal_step = true; + } + + Hook* end_hook; + Hook* step_signal_hook; + + bool signal_step; + uint32_t signal_step_number; + + + + +}; + + + +#endif -- 2.20.1