mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Embed: (wiki syntax)

« Back to documentation index

DigitalInOut Class Reference

DigitalInOut Class Reference
[Drivers]

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

#include <DigitalInOut.h>

Public Member Functions

 DigitalInOut (PinName pin)
 Create a DigitalInOut connected to the specified pin.
 DigitalInOut (PinName pin, PinDirection direction, PinMode mode, int value)
 Create a DigitalInOut connected to the specified pin.
void write (int value)
 Set the output, specified as 0 or 1 (int)
int read ()
 Return the output setting, represented as 0 or 1 (int)
void output ()
 Set as an output.
void input ()
 Set as an input.
void mode (PinMode pull)
 Set the input pin mode.
int is_connected ()
 Return the output setting, represented as 0 or 1 (int)
DigitalInOutoperator= (int value)
 A shorthand for write()
DigitalInOutoperator= (DigitalInOut &rhs)
 A shorthand for write() using the assignment operator which copies the state from the DigitalInOut argument.
 operator int ()
 A shorthand for read()
 DigitalInOut (PinName pin)
 Create a DigitalInOut connected to the specified pin.
 DigitalInOut (PinName pin, PinDirection direction, PinMode mode, int value)
 Create a DigitalInOut connected to the specified pin.
void write (int value)
 Set the output, specified as 0 or 1 (int)
int read ()
 Return the output setting, represented as 0 or 1 (int)
void output ()
 Set as an output.
void input ()
 Set as an input.
void mode (PinMode pull)
 Set the input pin mode.
int is_connected ()
 Return the output setting, represented as 0 or 1 (int)
DigitalInOutoperator= (int value)
 A shorthand for write()
DigitalInOutoperator= (DigitalInOut &rhs)
 A shorthand for write() using the assignment operator which copies the state from the DigitalInOut argument.
 operator int ()
 A shorthand for read()

Detailed Description

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

Note:
Synchronization level: Interrupt safe

Definition at line 33 of file cmsis/BUILD/mbed/drivers/DigitalInOut.h.


Constructor & Destructor Documentation

DigitalInOut ( PinName  pin )

Create a DigitalInOut connected to the specified pin.

Parameters:
pinDigitalInOut pin to connect to

Definition at line 40 of file cmsis/BUILD/mbed/drivers/DigitalInOut.h.

DigitalInOut ( PinName  pin,
PinDirection  direction,
PinMode  mode,
int  value 
)

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

Definition at line 53 of file cmsis/BUILD/mbed/drivers/DigitalInOut.h.

DigitalInOut ( PinName  pin )

Create a DigitalInOut connected to the specified pin.

Parameters:
pinDigitalInOut pin to connect to

Definition at line 40 of file drivers/DigitalInOut.h.

DigitalInOut ( PinName  pin,
PinDirection  direction,
PinMode  mode,
int  value 
)

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

Definition at line 53 of file drivers/DigitalInOut.h.


Member Function Documentation

void input (  )

Set as an input.

Definition at line 93 of file cmsis/BUILD/mbed/drivers/DigitalInOut.h.

void input (  )

Set as an input.

Definition at line 93 of file drivers/DigitalInOut.h.

int is_connected (  )

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

Definition at line 117 of file cmsis/BUILD/mbed/drivers/DigitalInOut.h.

int is_connected (  )

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

Definition at line 117 of file drivers/DigitalInOut.h.

void mode ( PinMode  pull )

Set the input pin mode.

Parameters:
pullPullUp, PullDown, PullNone, OpenDrain

Definition at line 104 of file cmsis/BUILD/mbed/drivers/DigitalInOut.h.

void mode ( PinMode  pull )

Set the input pin mode.

Parameters:
pullPullUp, PullDown, PullNone, OpenDrain

Definition at line 104 of file drivers/DigitalInOut.h.

operator int (  )

A shorthand for read()

See also:
DigitalInOut::read()
      DigitalInOut inout(PIN);
      DigitalOut led(LED1);

      inout.input();
      led = inout;   // Equivalent to led.write(inout.read())

Definition at line 162 of file cmsis/BUILD/mbed/drivers/DigitalInOut.h.

operator int (  )

A shorthand for read()

See also:
DigitalInOut::read()
      DigitalInOut inout(PIN);
      DigitalOut led(LED1);

      inout.input();
      led = inout;   // Equivalent to led.write(inout.read())

Definition at line 162 of file drivers/DigitalInOut.h.

DigitalInOut& operator= ( int  value )

A shorthand for write()

See also:
DigitalInOut::write()
      DigitalInOut  inout(PIN);
      DigitalIn     button(BUTTON1);
      inout.output();

      inout = button;     // Equivalent to inout.write(button.read())

Definition at line 133 of file drivers/DigitalInOut.h.

DigitalInOut& operator= ( DigitalInOut rhs )

A shorthand for write() using the assignment operator which copies the state from the DigitalInOut argument.

See also:
DigitalInOut::write()

Definition at line 144 of file drivers/DigitalInOut.h.

DigitalInOut& operator= ( DigitalInOut rhs )

A shorthand for write() using the assignment operator which copies the state from the DigitalInOut argument.

See also:
DigitalInOut::write()

Definition at line 144 of file cmsis/BUILD/mbed/drivers/DigitalInOut.h.

DigitalInOut& operator= ( int  value )

A shorthand for write()

See also:
DigitalInOut::write()
      DigitalInOut  inout(PIN);
      DigitalIn     button(BUTTON1);
      inout.output();

      inout = button;     // Equivalent to inout.write(button.read())

Definition at line 133 of file cmsis/BUILD/mbed/drivers/DigitalInOut.h.

void output (  )

Set as an output.

Definition at line 84 of file cmsis/BUILD/mbed/drivers/DigitalInOut.h.

void output (  )

Set as an output.

Definition at line 84 of file drivers/DigitalInOut.h.

int read (  )

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

Definition at line 76 of file cmsis/BUILD/mbed/drivers/DigitalInOut.h.

int read ( void   )

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

Definition at line 76 of file drivers/DigitalInOut.h.

void write ( int  value )

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

Definition at line 64 of file cmsis/BUILD/mbed/drivers/DigitalInOut.h.

void write ( int  value )

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

Definition at line 64 of file drivers/DigitalInOut.h.