nrfcxx
0.1.0
C++-17 Framework for Nordic nRF5 Devices
|
Base (or mixin) class for anything that supports a state_machine. More...
#include <nrfcxx/lpm.hpp>
Public Member Functions | |
virtual int | lpsm_start () |
Validate and prepare to initiate an LPM collection. More... | |
virtual int | lpsm_sample () |
Ask the LPM infrastructure to initiate a new sample. More... | |
lpm::state_machine::process_flags_type | lpsm_process () |
Make progress on an LPM collection. More... | |
int | lpsm_stop () |
int | lpsm_reset () |
int | lpsm_process_rc () const |
Get the internal result code from the last invocation of lpsm_process_(). More... | |
const lpm::state_machine & | machine () const |
Gain read-only access to the LPM machine state. | |
Protected Types | |
using | state_type = state_machine::state_type |
using | process_flags_type = state_machine::process_flags_type |
Protected Member Functions | |
lpsm_capable (notifier_type notify) | |
Create a state machine that records state and supports delayed transitions. More... | |
virtual int | lpsm_process_ (int &delay, process_flags_type &pf) |
Override to implement machine-specific operations of lpsm_process(). More... | |
virtual void | lpsm_reset_ () |
Override to reset state that is held outside the machine. | |
Protected Attributes | |
state_machine | machine_ |
Base (or mixin) class for anything that supports a state_machine.
This provides ownership of the machine, access to it, and the documentation and default implementation of the application-accessible machine operations.
|
inlineprotected |
Create a state machine that records state and supports delayed transitions.
notify | as with lpsm::state_machine. |
lpm::state_machine::process_flags_type nrfcxx::lpm::lpsm_capable::lpsm_process | ( | ) |
Make progress on an LPM collection.
This function should be invoked when the application detects that the need-to-process signal has been set.
|
inlineprotectedvirtual |
Override to implement machine-specific operations of lpsm_process().
The wrapper confirms that the machine is not in off, error, or failed state before invoking this function. If an error is returned the wrapper puts the machine into an error state; otherwise it sets up any requested delay and returns the process flags to its caller.
Applications may observe the last returned value through the lpsm_process_rc() API.
[out] | delay | set in the call to indicate that state_machine::post_event() should be invoked in support of either a blocking or fallback delay. |
[out] | pf | process flags to return to the caller. |
|
inline |
Get the internal result code from the last invocation of lpsm_process_().
This may be useful for diagnostics, but the value has no generic interpretation.
|
virtual |
Ask the LPM infrastructure to initiate a new sample.
The default implementation confirms that the machine is in state_machine::MS_IDLE and initiates a transition to state_machine::MS_ENTRY_SAMPLE.
Reimplemented in nrfcxx::sensor::hts221, and nrfcxx::sensor::lps22hb.
|
virtual |
Validate and prepare to initiate an LPM collection.
This should be invoked to transfer a machine from state_machine::MS_OFF. The default implementation initiates a move to state_machine::MS_ENTRY_START.
|
inline |