Mutila: Mouse's Utilities for Arduino
Oft-used utilities: debouncing buttons, averaging samples, and so on.
Public Member Functions | Protected Attributes | List of all members
ParentMode Class Reference

#include <ParentMode.h>

Inheritance diagram for ParentMode:
Inheritance graph

Public Member Functions

 ParentMode ()
 Constructor.
 
void switchMode (Mode *newMode)
 
- Public Member Functions inherited from Mode
 Mode ()
 
virtual void begin ()
 
virtual bool isFinished ()
 
void start ()
 
void stop ()
 
virtual void update ()
 
void setUpdatePeriod (uint16_t periodMs)
 

Protected Attributes

ModepMode
 
- Protected Attributes inherited from Mode
RunState _state
 
uint32_t _lastUpdateMs
 
uint16_t _updatePeriodMs
 

Additional Inherited Members

- Public Types inherited from Mode
enum  RunState {
  NotStarted, Started, Running, Finished,
  Stopped
}
 
- Protected Member Functions inherited from Mode
virtual void modeStart ()
 
virtual void modeStop ()
 
virtual void modeUpdate ()=0
 

Detailed Description

A Mode With Modes of it's own

A Parent Mode has one or more child Modes. One of these child modes is active at any one time. When the ParentModes update() member is called, the currently-active child Mode's update() is called.

Child Modes may themselves be a ParentMode, allowing for hierarchies of Modes.

It is customary for a ParentMode to implement the begin() member, and use it to call begin() for all of it's child modes. In this way the sketch which pulls in a ParentMode and it's tree of child modes must only call begin() for that one ParentMode.

Definition at line 20 of file ParentMode.h.

Member Function Documentation

◆ switchMode()

void ParentMode::switchMode ( Mode newMode)

Switch child mode

Parameters
newModethe address of the child Mode to switch to

Definition at line 8 of file ParentMode.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: