nrfcxx  0.1.0
C++-17 Framework for Nordic nRF5 Devices
Public Member Functions | Data Fields
nrfcxx::board::iox_pin Class Reference

Extension of gpio::generic_pin using the SX1509B IO extender. More...

#include </tmp/nrfcxx/board/thingy52/include/nrfcxx/board/thingy52.hpp>

Inheritance diagram for nrfcxx::board::iox_pin:
nrfcxx::gpio::generic_pin

Public Member Functions

 iox_pin (int psel)
 Construct the instance. More...
 
bool valid () const override
 Indicate whether the pin is functional. More...
 
void set () override
 Set the pin to drive the output high.
 
void clear () override
 Set the pin to drive the output low.
 
void toggle () override
 Toggle the pin drive state.
 
unsigned int configuration () const override
 Return implementation-specific information about the pin configuration. More...
 
void configure (unsigned int pin_cnf) override
 Set the PIN_CNF entry for the pin if the reference is valid. More...
 
bool read () const override
 Return the input signal observed at the pin, or zero if the reference is invalid.
 
bool is_set () const override
 Return true iff the pin is valid and is configured to drive the output high.
 

Data Fields

const uint16_t bit
 The bit associated with the pin on the IO extender.
 
const uint8_t psel
 The pin index on the IO extender, from 0 through 15 inclusive .
 

Detailed Description

Extension of gpio::generic_pin using the SX1509B IO extender.

Note
Changing the state of any pin requires about 128 us and the use of the I2C interface. At this time changing the configuration of a pin is not supported.

Constructor & Destructor Documentation

◆ iox_pin()

nrfcxx::board::iox_pin::iox_pin ( int  psel)
inline

Construct the instance.

Parameters
pselas with pin_reference. Note that this must be a valid pin selector on the device.

Member Function Documentation

◆ configuration()

unsigned int nrfcxx::board::iox_pin::configuration ( ) const
overridevirtual

Return implementation-specific information about the pin configuration.

Values should be as with pin_cnf in configure().

Reimplemented from nrfcxx::gpio::generic_pin.

◆ configure()

void nrfcxx::board::iox_pin::configure ( unsigned int  pin_cnf)
overridevirtual

Set the PIN_CNF entry for the pin if the reference is valid.

This API should always use the standard bit encoding of DIR, INPUT, PULL, DRIVE, and SENSE of Nordic nRF5 GPIO peripherals, even if the underlying implementation is a non-Nordic system.

Subclasses should provide access to any contained instance of a non-Nordic pin reference if the providing implementation requires configuration that is not supported in the Nordic GPIO bit encoding.

Parameters
pin_cnfa description of the desired pin configuration. This should

Reimplemented from nrfcxx::gpio::generic_pin.

◆ valid()

bool nrfcxx::board::iox_pin::valid ( ) const
inlineoverridevirtual

Indicate whether the pin is functional.

Base class returns false. Subclasses should override to return true in cases where invoking the other methods provides or affects pin state.

Reimplemented from nrfcxx::gpio::generic_pin.


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