nrfcxx  0.1.0
C++-17 Framework for Nordic nRF5 Devices
Data Structures | Public Types | Public Member Functions | Data Fields | Static Public Attributes
nrfcxx::gpio::active_signal< ACTIVE_HIGH > Class Template Reference

Wrapper supporting GPIO control of output signals by explicit or scoped assertion. More...

#include <nrfcxx/gpio.hpp>

Data Structures

struct  scoped_assert
 RAII instance used to assert the signal within a scope. More...
 

Public Types

using this_type = active_signal< active_high >
 

Public Member Functions

scoped_assert make_scoped () const
 Construct an RAII object that asserts the signal while it exists.
 
 active_signal (generic_pin &pin)
 Construct the helper for an active-low signal. More...
 
bool valid () const
 Indicate whether the signal is configured with a valid pin reference.
 
bool asserted () const
 Indicate whether the signal is currently asserted.
 
void assert () const
 Clear the associated GPIO to assert the active-low signal.
 
void deassert () const
 Set the associated GPIO to deassert the active-low signal.
 
void enable (unsigned int aux=0) const
 Configure the associated GPIO to control the signal output. More...
 
void disable () const
 Configure the associated GPIO to its power-up (non-controlling) state.
 

Data Fields

generic_pinpin
 

Static Public Attributes

static constexpr bool active_high = ACTIVE_HIGH
 

Detailed Description

template<bool ACTIVE_HIGH = false>
class nrfcxx::gpio::active_signal< ACTIVE_HIGH >

Wrapper supporting GPIO control of output signals by explicit or scoped assertion.

This references an externally defined generic_pin.

Template Parameters
ACTIVE_HIGHif true the pin asserts with a logic level high, and deasserts with a logic level low. If false (default) the pin asserts with a logic level low, and deasserts with a logic level high.

Constructor & Destructor Documentation

◆ active_signal()

template<bool ACTIVE_HIGH = false>
nrfcxx::gpio::active_signal< ACTIVE_HIGH >::active_signal ( generic_pin pin)
inline

Construct the helper for an active-low signal.

Warning
An attempt to create an instance for a psel that does not exist on the device will produce FailSsafeCode::NO_SUCH_PERIPHERAL.
Parameters
pselthe GPIO PSEL index for the signal.

Member Function Documentation

◆ enable()

template<bool ACTIVE_HIGH = false>
void nrfcxx::gpio::active_signal< ACTIVE_HIGH >::enable ( unsigned int  aux = 0) const
inline

Configure the associated GPIO to control the signal output.

Parameters
auxany additional flags (e.g. DRIVE) that would augment PIN_CNF_WRONLY to produce the correct configuration for the pin.

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