smoothie port to mbed online compiler (smoothieware.org)

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Pauser.cpp Source File

Pauser.cpp

00001 #include "libs/Kernel.h"
00002 #include "Pauser.h"
00003 #include "libs/nuts_bolts.h"
00004 #include "libs/utils.h"
00005 #include <string>
00006 using namespace std;
00007 
00008 Pauser::Pauser(){}
00009 
00010 void Pauser::on_module_loaded(){
00011     this->counter = 0;
00012 }
00013 
00014 void Pauser::take(){
00015     this->counter++;
00016     if( this->counter == 1 ){
00017         this->kernel->call_event(ON_PAUSE, &this->counter);
00018     }
00019 }
00020 
00021 void Pauser::release(){
00022     this->counter--;
00023     if( this->counter == 0 ){
00024         this->kernel->call_event(ON_PLAY, &this->counter);
00025     }
00026 }