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
BrownoutMode Class Reference

Mode class with brownout detection. More...

#include <BrownoutMode.h>

Inheritance diagram for BrownoutMode:
Inheritance graph

Public Member Functions

 BrownoutMode (EMAVDivSampler &vSampler, const float vThreshLow, const float vThreshHigh)
 
virtual void update ()
 
virtual void enterBrownout ()
 
virtual void exitBrownout ()
 
bool brownedOut ()
 
- Public Member Functions inherited from Mode
 Mode ()
 
virtual void begin ()
 
virtual bool isFinished ()
 
void start ()
 
void stop ()
 
void setUpdatePeriod (uint16_t periodMs)
 

Protected Attributes

EMAVDivSampler_vSampler
 
float _vThreshLow
 
float _vThreshHigh
 
bool _brownedOut
 
- 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

Mode class with brownout detection.

A mode implementation with members which are called when some monitored voltage drops below a low threshold or rises above a high threshold. This is typically used to save state to EEPROM when power is dying, or disable/ enable power-hungry activities if the voltage drops too low.

Definition at line 13 of file BrownoutMode.h.

Constructor & Destructor Documentation

◆ BrownoutMode()

BrownoutMode::BrownoutMode ( EMAVDivSampler vSampler,
const float  vThreshLow,
const float  vThreshHigh 
)

Constructor

Parameters
vSamplera EMAVDivSampler which will be used to test the brownout voltage
vThreshLowthe low threshold voltage
vThreshHighthe high threshold voltage

Definition at line 3 of file BrownoutMode.cpp.

Member Function Documentation

◆ brownedOut()

bool BrownoutMode::brownedOut ( )
inline

Test Brownout Status

Returns
true if device is currently browned out

Definition at line 42 of file BrownoutMode.h.

◆ enterBrownout()

virtual void BrownoutMode::enterBrownout ( )
inlinevirtual

Brownout entry callback This will be called once if the voltage measured by the sampler drops below the lower threshold.

Definition at line 31 of file BrownoutMode.h.

Here is the caller graph for this function:

◆ exitBrownout()

virtual void BrownoutMode::exitBrownout ( )
inlinevirtual

Brownout exit callback This will be called once if the voltage measured by the sampler rises above the higher threshold.

Definition at line 37 of file BrownoutMode.h.

Here is the caller graph for this function:

◆ update()

void BrownoutMode::update ( )
virtual

Allocate Timeslice Should be called frequently - typically from loop()

Reimplemented from Mode.

Definition at line 11 of file BrownoutMode.cpp.

Here is the call graph for this function:

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