Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
StepTicker.h
00001 /* 00002 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl). 00003 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. 00004 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. 00005 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. 00006 */ 00007 00008 00009 00010 #ifndef STEPTICKER_H 00011 #define STEPTICKER_H 00012 00013 using namespace std; 00014 #include <vector> 00015 #include "libs/nuts_bolts.h" 00016 #include "libs/Module.h" 00017 #include "libs/Kernel.h" 00018 00019 00020 class StepTicker{ 00021 public: 00022 StepTicker(); 00023 void set_frequency( double frequency ); 00024 void tick(); 00025 void set_reset_delay( double seconds ); 00026 void reset_tick(); 00027 00028 // For some reason this can't go in the .cpp, see : http://mbed.org/forum/mbed/topic/2774/?page=1#comment-14221 00029 template<typename T> void attach( T *optr, uint32_t ( T::*fptr )( uint32_t ) ){ 00030 FPointer* hook = new FPointer(); 00031 hook->attach(optr, fptr); 00032 this->hooks.push_back(hook); 00033 } 00034 00035 template<typename T> void reset_attach( T *optr, uint32_t ( T::*fptr )( uint32_t ) ){ 00036 FPointer* reset_hook = new FPointer(); 00037 reset_hook->attach(optr, fptr); 00038 this->reset_hooks.push_back(reset_hook); 00039 } 00040 00041 00042 vector<FPointer*> hooks; 00043 vector<FPointer*> reset_hooks; 00044 double frequency; 00045 00046 }; 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 #endif
Generated on Tue Jul 12 2022 14:14:42 by
1.7.2