nrfcxx  0.1.0
C++-17 Framework for Nordic nRF5 Devices
Public Member Functions
nrfcxx::periph::details::scoped_enabler< PERIPH > Class Template Reference

RAII instance that ensures the an instance is enabled within a scope. More...

#include <nrfcxx/periph.hpp>

Public Member Functions

 operator bool () const
 Boolean value is true iff construction completed with an enabled device.
 
ssize_type result () const
 The result of attempting to enable the peripheral. More...
 

Detailed Description

template<typename PERIPH>
class nrfcxx::periph::details::scoped_enabler< PERIPH >

RAII instance that ensures the an instance is enabled within a scope.

If constructed when the peripheral is not enabled the peripheral will be enabled. If this action fails the enabler instance will evaluate to false, indicating the peripheral is not functional. If it succeeds, the peripheral will be disabled when the instance is destructed.

If the peripheral is enabled prior to constructing the enabler its enabled state will not be changed when the enabler is destructed.

Member Function Documentation

◆ result()

template<typename PERIPH >
ssize_type nrfcxx::periph::details::scoped_enabler< PERIPH >::result ( ) const
inline

The result of attempting to enable the peripheral.

Returns
0 if peripheral was already enabled on construction, positive if construction caused the peripheral to be enabled, or a negative encoded error.

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