DUDS
Distributed Update of Data from Something
duds::hardware::interface::linux::GpioRequest Class Referenceabstract

An abstraction for using gpiohandle_request object(s). More...

Inheritance diagram for duds::hardware::interface::linux::GpioRequest:

Public Member Functions

virtual ~GpioRequest ()
 
virtual void inputOffset (int chipFd, std::uint32_t offset)=0
 Configures the pin at the given offset as an input. More...
 
virtual bool inputState (int chipFd, std::uint32_t offset)=0
 Reads the input state of the indicated pin. More...
 
virtual void outputOffset (int chipFd, std::uint32_t offset, bool state)=0
 Configures the pin at the given offset as an output. More...
 
virtual void outputState (std::uint32_t offset, bool state)=0
 Sets the output state of a single pin in advance of making the output request to the port. More...
 
virtual void read (int chipFd, gpiohandle_data &result, std::uint32_t *&offsets, int &length)=0
 Read from all input pins. More...
 
virtual void write (int chipFd)=0
 Configures pins as outputs and sets their output states. More...
 
virtual void write (int chipFd, std::uint32_t offset, bool state)=0
 Sets the output state of a single output pin. More...
 

Detailed Description

An abstraction for using gpiohandle_request object(s).

Author
Jeff Jackowski

Definition at line 180 of file GpioDevPort.cpp.

Constructor & Destructor Documentation

◆ ~GpioRequest()

virtual duds::hardware::interface::linux::GpioRequest::~GpioRequest ( )
inlinevirtual

Definition at line 182 of file GpioDevPort.cpp.

Member Function Documentation

◆ inputOffset()

virtual void duds::hardware::interface::linux::GpioRequest::inputOffset ( int  chipFd,
std::uint32_t  offset 
)
pure virtual

Configures the pin at the given offset as an input.

Parameters
chipFdThe file descriptor for the GPIO device.
offsetThe pin offset.

Implemented in duds::hardware::interface::linux::IoGpioRequest, and duds::hardware::interface::linux::SingleGpioRequest.

Referenced by duds::hardware::interface::linux::GpioDevPort::configurePort(), and ~GpioRequest().

◆ inputState()

virtual bool duds::hardware::interface::linux::GpioRequest::inputState ( int  chipFd,
std::uint32_t  offset 
)
pure virtual

Reads the input state of the indicated pin.

Configures the pin as an input if not already an input.

Parameters
chipFdThe file descriptor for the GPIO device.
offsetThe pin offset.

Implemented in duds::hardware::interface::linux::IoGpioRequest, and duds::hardware::interface::linux::SingleGpioRequest.

Referenced by duds::hardware::interface::linux::GpioDevPort::inputImpl(), and ~GpioRequest().

◆ outputOffset()

virtual void duds::hardware::interface::linux::GpioRequest::outputOffset ( int  chipFd,
std::uint32_t  offset,
bool  state 
)
pure virtual

Configures the pin at the given offset as an output.

Parameters
chipFdThe file descriptor for the GPIO device.
offsetThe pin offset.
stateThe output state for the pin.

Implemented in duds::hardware::interface::linux::IoGpioRequest, and duds::hardware::interface::linux::SingleGpioRequest.

Referenced by duds::hardware::interface::linux::GpioDevPort::configurePort(), and ~GpioRequest().

◆ outputState()

virtual void duds::hardware::interface::linux::GpioRequest::outputState ( std::uint32_t  offset,
bool  state 
)
pure virtual

Sets the output state of a single pin in advance of making the output request to the port.

Use write(int) to output the data.

Parameters
offsetThe pin offset.
stateThe output state to store for the pin.

Implemented in duds::hardware::interface::linux::IoGpioRequest, and duds::hardware::interface::linux::SingleGpioRequest.

Referenced by duds::hardware::interface::linux::GpioDevPort::outputImpl(), and ~GpioRequest().

◆ read()

virtual void duds::hardware::interface::linux::GpioRequest::read ( int  chipFd,
gpiohandle_data &  result,
std::uint32_t *&  offsets,
int &  length 
)
pure virtual

Read from all input pins.

Parameters
chipFdThe file descriptor for the GPIO device.
resultThe input states.
offsetsA pointer to the start of an array with the line offset values for identifying where the input source.
lengthThe number of line offsets.

Implemented in duds::hardware::interface::linux::IoGpioRequest, and duds::hardware::interface::linux::SingleGpioRequest.

Referenced by duds::hardware::interface::linux::GpioDevPort::inputImpl(), and ~GpioRequest().

◆ write() [1/2]

virtual void duds::hardware::interface::linux::GpioRequest::write ( int  chipFd)
pure virtual

Configures pins as outputs and sets their output states.

Parameters
chipFdThe file descriptor for the GPIO device.

Implemented in duds::hardware::interface::linux::IoGpioRequest, and duds::hardware::interface::linux::SingleGpioRequest.

Referenced by duds::hardware::interface::linux::GpioDevPort::outputImpl(), and ~GpioRequest().

◆ write() [2/2]

virtual void duds::hardware::interface::linux::GpioRequest::write ( int  chipFd,
std::uint32_t  offset,
bool  state 
)
pure virtual

Sets the output state of a single output pin.

Precondition
The pin is already configured as an output.
Parameters
chipFdThe file descriptor for the GPIO device.
offsetThe pin offset.
stateThe output state for the pin.

Implemented in duds::hardware::interface::linux::IoGpioRequest, and duds::hardware::interface::linux::SingleGpioRequest.


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