Mutila: Mouse's Utilities for Arduino
Oft-used utilities: debouncing buttons, averaging samples, and so on.
|
Mode class with brownout detection. More...
#include <BrownoutMode.h>
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 |
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.
BrownoutMode::BrownoutMode | ( | EMAVDivSampler & | vSampler, |
const float | vThreshLow, | ||
const float | vThreshHigh | ||
) |
Constructor
vSampler | a EMAVDivSampler which will be used to test the brownout voltage |
vThreshLow | the low threshold voltage |
vThreshHigh | the high threshold voltage |
Definition at line 3 of file BrownoutMode.cpp.
|
inline |
Test Brownout Status
Definition at line 42 of file BrownoutMode.h.
|
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.
|
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.
|
virtual |
Allocate Timeslice Should be called frequently - typically from loop()
Reimplemented from Mode.
Definition at line 11 of file BrownoutMode.cpp.