smoothie port to mbed online compiler (smoothieware.org)
For documentation, license, ..., please check http://smoothieware.org/
This version has been tested with a 3 axis machine
libs/Pauser.cpp@0:31e91bb0ef3c, 2012-07-31 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
scachat | 0:31e91bb0ef3c | 1 | #include "libs/Kernel.h" |
scachat | 0:31e91bb0ef3c | 2 | #include "Pauser.h" |
scachat | 0:31e91bb0ef3c | 3 | #include "libs/nuts_bolts.h" |
scachat | 0:31e91bb0ef3c | 4 | #include "libs/utils.h" |
scachat | 0:31e91bb0ef3c | 5 | #include <string> |
scachat | 0:31e91bb0ef3c | 6 | using namespace std; |
scachat | 0:31e91bb0ef3c | 7 | |
scachat | 0:31e91bb0ef3c | 8 | Pauser::Pauser(){} |
scachat | 0:31e91bb0ef3c | 9 | |
scachat | 0:31e91bb0ef3c | 10 | void Pauser::on_module_loaded(){ |
scachat | 0:31e91bb0ef3c | 11 | this->counter = 0; |
scachat | 0:31e91bb0ef3c | 12 | } |
scachat | 0:31e91bb0ef3c | 13 | |
scachat | 0:31e91bb0ef3c | 14 | void Pauser::take(){ |
scachat | 0:31e91bb0ef3c | 15 | this->counter++; |
scachat | 0:31e91bb0ef3c | 16 | if( this->counter == 1 ){ |
scachat | 0:31e91bb0ef3c | 17 | this->kernel->call_event(ON_PAUSE, &this->counter); |
scachat | 0:31e91bb0ef3c | 18 | } |
scachat | 0:31e91bb0ef3c | 19 | } |
scachat | 0:31e91bb0ef3c | 20 | |
scachat | 0:31e91bb0ef3c | 21 | void Pauser::release(){ |
scachat | 0:31e91bb0ef3c | 22 | this->counter--; |
scachat | 0:31e91bb0ef3c | 23 | if( this->counter == 0 ){ |
scachat | 0:31e91bb0ef3c | 24 | this->kernel->call_event(ON_PLAY, &this->counter); |
scachat | 0:31e91bb0ef3c | 25 | } |
scachat | 0:31e91bb0ef3c | 26 | } |