mbed-drivers
Public Member Functions | Protected Attributes | List of all members
mbed::DigitalInOut Class Reference

#include <DigitalInOut.h>

Public Member Functions

 DigitalInOut (PinName pin)
 
 DigitalInOut (PinName pin, PinDirection direction, PinMode mode, int value)
 
void write (int value)
 
int read ()
 
void output ()
 
void input ()
 
void mode (PinMode pull)
 
DigitalInOutoperator= (int value)
 
DigitalInOutoperator= (DigitalInOut &rhs)
 
 operator int ()
 

Protected Attributes

gpio_t gpio
 

Detailed Description

A digital input/output, used for setting or reading a bi-directional pin

Constructor & Destructor Documentation

mbed::DigitalInOut::DigitalInOut ( PinName  pin)
inline

Create a DigitalInOut connected to the specified pin

Parameters
pinDigitalInOut pin to connect to
mbed::DigitalInOut::DigitalInOut ( PinName  pin,
PinDirection  direction,
PinMode  mode,
int  value 
)
inline

Create a DigitalInOut connected to the specified pin

Parameters
pinDigitalInOut pin to connect to
directionthe initial direction of the pin
modethe initial mode of the pin
valuethe initial value of the pin if is an output

Member Function Documentation

void mbed::DigitalInOut::input ( )
inline

Set as an input

void mbed::DigitalInOut::mode ( PinMode  pull)
inline

Set the input pin mode

Parameters
modePullUp, PullDown, PullNone, OpenDrain
mbed::DigitalInOut::operator int ( )
inline

A shorthand for read()

DigitalInOut& mbed::DigitalInOut::operator= ( int  value)
inline

A shorthand for write()

void mbed::DigitalInOut::output ( )
inline

Set as an output

int mbed::DigitalInOut::read ( )
inline

Return the output setting, represented as 0 or 1 (int)

Returns
an integer representing the output setting of the pin if it is an output, or read the input if set as an input
void mbed::DigitalInOut::write ( int  value)
inline

Set the output, specified as 0 or 1 (int)

Parameters
valueAn integer specifying the pin output value, 0 for logical 0, 1 (or any other non-zero value) for logical 1

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