Mbed OS Reference
Loading...
Searching...
No Matches
PortInOut Class Reference

A multiple pin digital in/out used to set/read multiple bi-directional pins. More...

#include <PortInOut.h>

Public Member Functions

 PortInOut (PortName port, int mask=0xFFFFFFFF)
 Create an PortInOut, connected to the specified port. More...
 
void write (int value)
 Write the value to the output port. More...
 
int read ()
 Read the value currently output on the port. More...
 
void output ()
 Set as an output. More...
 
void input ()
 Set as an input. More...
 
void mode (PinMode mode)
 Set the input pin mode. More...
 
PortInOutoperator= (int value)
 A shorthand for write() More...
 
PortInOutoperator= (PortInOut &rhs)
 A shorthand for write() More...
 
 operator int ()
 A shorthand for read() More...
 

Detailed Description

A multiple pin digital in/out used to set/read multiple bi-directional pins.

Note
Synchronization level: Interrupt safe

Definition at line 37 of file PortInOut.h.

Constructor & Destructor Documentation

◆ PortInOut()

PortInOut ( PortName  port,
int  mask = 0xFFFFFFFF 
)

Create an PortInOut, connected to the specified port.

Parameters
portPort to connect to (Port0-Port5)
maskA bitmask to identify which bits in the port should be included (0 - ignore)

Member Function Documentation

◆ write()

void write ( int  value)

Write the value to the output port.

Parameters
valueAn integer specifying a bit to write for every corresponding port pin

Definition at line 51 of file PortInOut.h.

◆ read()

int read ( )

Read the value currently output on the port.

Returns
An integer with each bit corresponding to associated port pin setting

Definition at line 61 of file PortInOut.h.

◆ output()

void output ( )

Set as an output.

◆ input()

void input ( )

Set as an input.

◆ mode()

void mode ( PinMode  mode)

Set the input pin mode.

Parameters
modePullUp, PullDown, PullNone, OpenDrain

◆ operator=() [1/2]

PortInOut & operator= ( int  value)

A shorthand for write()

See also
PortInOut::write()

Definition at line 83 of file PortInOut.h.

◆ operator=() [2/2]

PortInOut & operator= ( PortInOut rhs)

A shorthand for write()

See also
PortInOut::write()

Definition at line 92 of file PortInOut.h.

◆ operator int()

operator int ( )

A shorthand for read()

See also
PortInOut::read()

Definition at line 101 of file PortInOut.h.