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.
Fork of Smoothie by
Diff: libs/Pauser.cpp
- Revision:
- 0:31e91bb0ef3c
- Child:
- 2:1df0b61d3b5a
diff -r 000000000000 -r 31e91bb0ef3c libs/Pauser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libs/Pauser.cpp Tue Jul 31 21:11:18 2012 +0000 @@ -0,0 +1,26 @@ +#include "libs/Kernel.h" +#include "Pauser.h" +#include "libs/nuts_bolts.h" +#include "libs/utils.h" +#include <string> +using namespace std; + +Pauser::Pauser(){} + +void Pauser::on_module_loaded(){ + this->counter = 0; +} + +void Pauser::take(){ + this->counter++; + if( this->counter == 1 ){ + this->kernel->call_event(ON_PAUSE, &this->counter); + } +} + +void Pauser::release(){ + this->counter--; + if( this->counter == 0 ){ + this->kernel->call_event(ON_PLAY, &this->counter); + } +}