Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions | Protected Attributes
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)
 
int is_connected ()
 
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

Note
Synchronization level: Interrupt safe

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

int mbed::DigitalInOut::is_connected ( )
inline

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

Returns
Non zero value if pin is connected to uc GPIO 0 if gpio object was initialized with NC
void mbed::DigitalInOut::mode ( PinMode  pull)
inline

Set the input pin mode

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

A shorthand for read()

See also
DigitalInOut::read()
DigitalInOut& mbed::DigitalInOut::operator= ( int  value)
inline

A shorthand for write()

See also
DigitalInOut::write()
DigitalInOut& mbed::DigitalInOut::operator= ( DigitalInOut rhs)
inline

A shorthand for write()

See also
DigitalInOut::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:
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.