Michael Spencer / Smoothie

Dependencies:   mbed

Fork of Smoothie by Stéphane Cachat

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);
+    }
+}