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

Implements using a single gpiohandle_request object for working with a single pin. More...

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

Public Member Functions

 SingleGpioRequest (const std::string &consumer, std::uint32_t offset)
 
virtual ~SingleGpioRequest ()
 
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...
 
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 req
 The request object. More...
 

Detailed Description

Implements using a single gpiohandle_request object for working with a single pin.

Author
Jeff Jackowski

Definition at line 244 of file GpioDevPort.cpp.

Constructor & Destructor Documentation

◆ SingleGpioRequest()

duds::hardware::interface::linux::SingleGpioRequest::SingleGpioRequest ( const std::string &  consumer,
std::uint32_t  offset 
)
inline

Definition at line 250 of file GpioDevPort.cpp.

◆ ~SingleGpioRequest()

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

Definition at line 255 of file GpioDevPort.cpp.

Member Function Documentation

◆ inputOffset()

virtual void duds::hardware::interface::linux::SingleGpioRequest::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 258 of file GpioDevPort.cpp.

◆ inputState()

virtual bool duds::hardware::interface::linux::SingleGpioRequest::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 311 of file GpioDevPort.cpp.

◆ outputOffset()

virtual void duds::hardware::interface::linux::SingleGpioRequest::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 270 of file GpioDevPort.cpp.

◆ outputState()

virtual void duds::hardware::interface::linux::SingleGpioRequest::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 323 of file GpioDevPort.cpp.

◆ read()

virtual void duds::hardware::interface::linux::SingleGpioRequest::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 283 of file GpioDevPort.cpp.

◆ write() [1/2]

virtual void duds::hardware::interface::linux::SingleGpioRequest::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 293 of file GpioDevPort.cpp.

◆ write() [2/2]

virtual void duds::hardware::interface::linux::SingleGpioRequest::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 296 of file GpioDevPort.cpp.

Member Data Documentation

◆ req

gpiohandle_request duds::hardware::interface::linux::SingleGpioRequest::req
private

The request object.

Definition at line 248 of file GpioDevPort.cpp.


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