DUDS
Distributed Update of Data from Something
duds::hardware::interface::linux::IoGpioRequest Class Reference

Implements using two gpiohandle_requests object for working with multiple pins. More...

Inheritance diagram for duds::hardware::interface::linux::IoGpioRequest:
Collaboration diagram for duds::hardware::interface::linux::IoGpioRequest:

Public Member Functions

 IoGpioRequest (const std::string &consumer)
 
virtual ~IoGpioRequest ()
 
void addInputOffset (std::uint32_t offset)
 Adds an offset for input use. More...
 
void addOutputOffset (std::uint32_t offset, bool state)
 Adds an offset for output use and sets the initial output state. More...
 
virtual void inputOffset (int chipFd, std::uint32_t offset)
 Configures the pin at the given offset as an input. More...
 
virtual bool inputState (int chipFd, std::uint32_t offset)
 Reads the input state of the indicated pin. More...
 
void lastOutputState (bool state)
 
virtual void outputOffset (int chipFd, std::uint32_t offset, bool state)
 Configures the pin at the given offset as an output. More...
 
virtual void outputState (std::uint32_t offset, bool state)
 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)
 Read from all input pins. More...
 
virtual void write (int chipFd)
 Configures pins as outputs and sets their output states. More...
 
virtual void write (int chipFd, std::uint32_t offset, bool state)
 Sets the output state of a single output pin. More...
 
- Public Member Functions inherited from duds::hardware::interface::linux::GpioRequest
virtual ~GpioRequest ()
 

Private Attributes

gpiohandle_request inReq
 Input request. More...
 
gpiohandle_request outReq
 Output request. More...
 

Detailed Description

Implements using two gpiohandle_requests object for working with multiple pins.

Author
Jeff Jackowski

Definition at line 335 of file GpioDevPort.cpp.

Constructor & Destructor Documentation

◆ IoGpioRequest()

duds::hardware::interface::linux::IoGpioRequest::IoGpioRequest ( const std::string &  consumer)
inline

Definition at line 345 of file GpioDevPort.cpp.

◆ ~IoGpioRequest()

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

Definition at line 351 of file GpioDevPort.cpp.

Member Function Documentation

◆ addInputOffset()

void duds::hardware::interface::linux::IoGpioRequest::addInputOffset ( std::uint32_t  offset)
inline

Adds an offset for input use.

Precondition
The offset is not in either the input or output set.

Definition at line 362 of file GpioDevPort.cpp.

Referenced by duds::hardware::interface::linux::GpioDevPort::madeAccess().

◆ addOutputOffset()

void duds::hardware::interface::linux::IoGpioRequest::addOutputOffset ( std::uint32_t  offset,
bool  state 
)
inline

Adds an offset for output use and sets the initial output state.

Precondition
The offset is not in either the input or output set.

Definition at line 369 of file GpioDevPort.cpp.

Referenced by duds::hardware::interface::linux::GpioDevPort::madeAccess().

◆ inputOffset()

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

Configures the pin at the given offset as an input.

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

Implements duds::hardware::interface::linux::GpioRequest.

Definition at line 373 of file GpioDevPort.cpp.

◆ inputState()

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

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.

Implements duds::hardware::interface::linux::GpioRequest.

Definition at line 425 of file GpioDevPort.cpp.

◆ lastOutputState()

void duds::hardware::interface::linux::IoGpioRequest::lastOutputState ( bool  state)
inline

Definition at line 355 of file GpioDevPort.cpp.

◆ outputOffset()

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

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.

Implements duds::hardware::interface::linux::GpioRequest.

Definition at line 386 of file GpioDevPort.cpp.

◆ outputState()

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

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.

Implements duds::hardware::interface::linux::GpioRequest.

Definition at line 432 of file GpioDevPort.cpp.

◆ read()

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

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.

Implements duds::hardware::interface::linux::GpioRequest.

Definition at line 400 of file GpioDevPort.cpp.

◆ write() [1/2]

virtual void duds::hardware::interface::linux::IoGpioRequest::write ( int  chipFd)
inlinevirtual

Configures pins as outputs and sets their output states.

Parameters
chipFdThe file descriptor for the GPIO device.

Implements duds::hardware::interface::linux::GpioRequest.

Definition at line 410 of file GpioDevPort.cpp.

◆ write() [2/2]

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

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.

Implements duds::hardware::interface::linux::GpioRequest.

Definition at line 415 of file GpioDevPort.cpp.

Member Data Documentation

◆ inReq

gpiohandle_request duds::hardware::interface::linux::IoGpioRequest::inReq
private

Input request.

Definition at line 339 of file GpioDevPort.cpp.

◆ outReq

gpiohandle_request duds::hardware::interface::linux::IoGpioRequest::outReq
private

Output request.

Definition at line 343 of file GpioDevPort.cpp.


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