Mutila: Mouse's Utilities for Arduino
Oft-used utilities: debouncing buttons, averaging samples, and so on.
|
#include <ModeManager.h>
Public Member Functions | |
void | begin (Mode *initialMode) |
void | update () |
void | switchMode (Mode *newMode, bool force=false) |
bool | modeFinished () |
Public Attributes | |
Mode * | currentMode |
ModeManager class for switching between mutually exclusive Modes.
Definition at line 7 of file ModeManager.h.
void ModeManager::begin | ( | Mode * | initialMode | ) |
Initialization.
Typically called from setup().
initialMode | the mode to start in. |
Definition at line 9 of file ModeManager.cpp.
bool ModeManager::modeFinished | ( | ) |
Check to see if the current mode is finished.
Definition at line 33 of file ModeManager.cpp.
void ModeManager::switchMode | ( | Mode * | newMode, |
bool | force = false |
||
) |
Change Mode.
Call to end the current Mode and start the new Mode.
newMode | the new mode to switch to. |
force | calling stop in current mode and start in new mode, even if they are the same. |
Definition at line 22 of file ModeManager.cpp.
void ModeManager::update | ( | ) |
Allocate timeslice.
Called frequently to update the current mode, typically from loop().
Definition at line 15 of file ModeManager.cpp.