nrfcxx
0.1.0
C++-17 Framework for Nordic nRF5 Devices
|
Generalized reference to a GPIO pin using a global psel ordinal. More...
#include <nrfcxx/gpio.hpp>
Public Member Functions | |
void | set () const |
Set the pin to drive the output high. | |
void | clear () const |
Set the pin to drive the output low. | |
void | toggle () const |
Toggle the pin drive state. | |
uint32_t | configuration () const |
Return the PIN_CNF entry for the pin, or zero if the reference is invalid. | |
void | configure (uint32_t pin_cnf) const |
Set the PIN_CNF entry for the pin. | |
bool | read () const |
Return the input signal observed at the pin, or zero if the reference is invalid. | |
bool | is_set () const |
Return true iff the pin is valid and is configured to drive the output high. | |
Static Public Member Functions | |
static pin_reference | create (int psel) |
Construct the instance for the given global ordinal GPIO pin. More... | |
Data Fields | |
uint8_t const | global_psel |
The pin selector index across all GPIO instances. | |
uint8_t const | local_psel |
The pin selector index within peripheral. | |
uint32_t const | local_bit |
A mask isolating the local_psel bit within the value space of peripheral. | |
const nrf5::GPIO_Type & | peripheral |
Reference to a valid GPIO peripheral wrapper. More... | |
Generalized reference to a GPIO pin using a global psel ordinal.
This allows using psel values like 42 at runtime to identify the 10th GPIO on the second GPIO peripheral.
|
static |
Construct the instance for the given global ordinal GPIO pin.
psel | a valid pin index from 0 to nrf5::GPIO_PSEL_COUNT. |
const nrf5::GPIO_Type& nrfcxx::gpio::pin_reference::peripheral |
Reference to a valid GPIO peripheral wrapper.
This is the GPIO peripheral to which the pin belongs.