smoothie port to mbed online compiler (smoothieware.org)

Dependencies:   mbed

For documentation, license, ..., please check http://smoothieware.org/

This version has been tested with a 3 axis machine

Committer:
scachat
Date:
Tue Jul 31 21:11:18 2012 +0000
Revision:
0:31e91bb0ef3c
smoothie port to mbed online compiler

Who changed what in which revision?

UserRevisionLine numberNew contents of line
scachat 0:31e91bb0ef3c 1 /*
scachat 0:31e91bb0ef3c 2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
scachat 0:31e91bb0ef3c 3 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.
scachat 0:31e91bb0ef3c 4 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.
scachat 0:31e91bb0ef3c 5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
scachat 0:31e91bb0ef3c 6 */
scachat 0:31e91bb0ef3c 7
scachat 0:31e91bb0ef3c 8
scachat 0:31e91bb0ef3c 9
scachat 0:31e91bb0ef3c 10 #ifndef STEPTICKER_H
scachat 0:31e91bb0ef3c 11 #define STEPTICKER_H
scachat 0:31e91bb0ef3c 12
scachat 0:31e91bb0ef3c 13 using namespace std;
scachat 0:31e91bb0ef3c 14 #include <vector>
scachat 0:31e91bb0ef3c 15 #include "libs/nuts_bolts.h"
scachat 0:31e91bb0ef3c 16 #include "libs/Module.h"
scachat 0:31e91bb0ef3c 17 #include "libs/Kernel.h"
scachat 0:31e91bb0ef3c 18
scachat 0:31e91bb0ef3c 19
scachat 0:31e91bb0ef3c 20 class StepTicker{
scachat 0:31e91bb0ef3c 21 public:
scachat 0:31e91bb0ef3c 22 StepTicker();
scachat 0:31e91bb0ef3c 23 void set_frequency( double frequency );
scachat 0:31e91bb0ef3c 24 void tick();
scachat 0:31e91bb0ef3c 25 void set_reset_delay( double seconds );
scachat 0:31e91bb0ef3c 26 void reset_tick();
scachat 0:31e91bb0ef3c 27
scachat 0:31e91bb0ef3c 28 // For some reason this can't go in the .cpp, see : http://mbed.org/forum/mbed/topic/2774/?page=1#comment-14221
scachat 0:31e91bb0ef3c 29 template<typename T> void attach( T *optr, uint32_t ( T::*fptr )( uint32_t ) ){
scachat 0:31e91bb0ef3c 30 FPointer* hook = new FPointer();
scachat 0:31e91bb0ef3c 31 hook->attach(optr, fptr);
scachat 0:31e91bb0ef3c 32 this->hooks.push_back(hook);
scachat 0:31e91bb0ef3c 33 }
scachat 0:31e91bb0ef3c 34
scachat 0:31e91bb0ef3c 35 template<typename T> void reset_attach( T *optr, uint32_t ( T::*fptr )( uint32_t ) ){
scachat 0:31e91bb0ef3c 36 FPointer* reset_hook = new FPointer();
scachat 0:31e91bb0ef3c 37 reset_hook->attach(optr, fptr);
scachat 0:31e91bb0ef3c 38 this->reset_hooks.push_back(reset_hook);
scachat 0:31e91bb0ef3c 39 }
scachat 0:31e91bb0ef3c 40
scachat 0:31e91bb0ef3c 41
scachat 0:31e91bb0ef3c 42 vector<FPointer*> hooks;
scachat 0:31e91bb0ef3c 43 vector<FPointer*> reset_hooks;
scachat 0:31e91bb0ef3c 44 double frequency;
scachat 0:31e91bb0ef3c 45
scachat 0:31e91bb0ef3c 46 };
scachat 0:31e91bb0ef3c 47
scachat 0:31e91bb0ef3c 48
scachat 0:31e91bb0ef3c 49
scachat 0:31e91bb0ef3c 50
scachat 0:31e91bb0ef3c 51
scachat 0:31e91bb0ef3c 52
scachat 0:31e91bb0ef3c 53
scachat 0:31e91bb0ef3c 54
scachat 0:31e91bb0ef3c 55
scachat 0:31e91bb0ef3c 56
scachat 0:31e91bb0ef3c 57
scachat 0:31e91bb0ef3c 58 #endif