Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
MCP23017Gpio Class Reference
Inheritance diagram for MCP23017Gpio:
Gpio

Public Member Functions

constexpr MCP23017Gpio (MCP23017 *const parent, unsigned port, unsigned pin)
 
void set () const override
 Sets the GPIO output pin to high.
 
void clr () const override
 Clears the GPIO output pin to low.
 
void write (Value new_state) const override
 Writes a GPIO output pin (set or clear to a specific state).
 
Value read () const override
 Retrieves the current Value of a GPIO input pin.
 
void set_direction (Direction dir) const override
 Sets the GPIO direction.
 
Direction direction () const override
 Gets the GPIO direction.
 
- Public Member Functions inherited from Gpio
constexpr Gpio ()
 Constructor.
 
void write (bool new_state) const
 Writes a GPIO output pin (set or clear to a specific state).
 
bool is_set () const
 Tests the GPIO input pin to see if it is set.
 
bool is_clr () const
 Tests the GPIO input pin to see if it is clear.
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (MCP23017Gpio)
 

Private Attributes

MCP23017 *const parent_
 
const uint8_t port_
 0 or 1 for portA/B
 
const uint8_t pinBit_
 one bit that denotes the output pin.
 

Additional Inherited Members

- Public Types inherited from Gpio
enum  Value : bool { CLR = false , SET = true , VLOW = CLR , VHIGH = SET }
 Defines the options for GPIO level. More...
 
enum class  Direction { DINPUT , DOUTPUT }
 Defines the options for GPIO direction. More...
 

Detailed Description

Definition at line 269 of file MCP23017Gpio.hxx.

Constructor & Destructor Documentation

◆ MCP23017Gpio()

constexpr MCP23017Gpio::MCP23017Gpio ( MCP23017 *const  parent,
unsigned  port,
unsigned  pin 
)
inlineconstexpr

Definition at line 272 of file MCP23017Gpio.hxx.

Member Function Documentation

◆ clr()

void MCP23017Gpio::clr ( ) const
inlineoverridevirtual

Clears the GPIO output pin to low.

Implements Gpio.

Definition at line 284 of file MCP23017Gpio.hxx.

◆ direction()

Direction MCP23017Gpio::direction ( ) const
inlineoverridevirtual

Gets the GPIO direction.

Returns
INPUT or OUTPUT

Implements Gpio.

Definition at line 333 of file MCP23017Gpio.hxx.

◆ read()

Value MCP23017Gpio::read ( ) const
inlineoverridevirtual

Retrieves the current Value of a GPIO input pin.

Returns
SET if currently high, CLR if currently low.

Implements Gpio.

Definition at line 307 of file MCP23017Gpio.hxx.

◆ set()

void MCP23017Gpio::set ( ) const
inlineoverridevirtual

Sets the GPIO output pin to high.

Implements Gpio.

Definition at line 279 of file MCP23017Gpio.hxx.

◆ set_direction()

void MCP23017Gpio::set_direction ( Direction  dir) const
inlineoverridevirtual

Sets the GPIO direction.

Parameters
dirINPUT or OUTPUT

Implements Gpio.

Definition at line 321 of file MCP23017Gpio.hxx.

◆ write()

void MCP23017Gpio::write ( Value  new_state) const
inlineoverridevirtual

Writes a GPIO output pin (set or clear to a specific state).

Parameters
new_statethe desired output state. See Value.

Implements Gpio.

Definition at line 289 of file MCP23017Gpio.hxx.

Member Data Documentation

◆ parent_

MCP23017* const MCP23017Gpio::parent_
private

Definition at line 348 of file MCP23017Gpio.hxx.

◆ pinBit_

const uint8_t MCP23017Gpio::pinBit_
private

one bit that denotes the output pin.

Definition at line 352 of file MCP23017Gpio.hxx.

◆ port_

const uint8_t MCP23017Gpio::port_
private

0 or 1 for portA/B

Definition at line 350 of file MCP23017Gpio.hxx.


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