PlayLed: use Pauser::paused() instead of referencing PauseButton.
authorMichael Moon <triffid.hunter@gmail.com>
Wed, 6 Mar 2013 04:02:54 +0000 (15:02 +1100)
committerMichael Moon <triffid.hunter@gmail.com>
Wed, 6 Mar 2013 04:02:54 +0000 (15:02 +1100)
PauseButton: no longer need static self-reference

src/modules/utils/PlayLed/PlayLed.cpp
src/modules/utils/pausebutton/PauseButton.cpp
src/modules/utils/pausebutton/PauseButton.h

index 127fbce..afd6304 100644 (file)
@@ -51,7 +51,7 @@ void PlayLed::on_play(void* argument)
 
 uint32_t PlayLed::half_second_tick(uint32_t)
 {
-    if (!PauseButton::instance->play_state)
+    if (kernel->pauser->paused())
         led.set(!led.get());
 
     return 0;
index 4d6bb09..b7dc677 100644 (file)
@@ -5,12 +5,7 @@
 #include <string>
 using namespace std;
 
-// so other modules can find us
-PauseButton* PauseButton::instance;
-
-PauseButton::PauseButton(){
-    instance = this;
-}
+PauseButton::PauseButton(){}
 
 void PauseButton::on_module_loaded(){
     this->button_state = true;
index 31c5dac..73b3bc3 100644 (file)
@@ -21,8 +21,6 @@ class PauseButton : public Module {
         Pin        button;
         bool       button_state;
         bool       play_state;
-
-        static PauseButton* instance;
 };
 
 #endif