Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
GpioBusOut Class Reference
GpioBusOut class. More...
#include <GpioBusOut.h>
Inherits GpioBusInOut.
Public Types | |
enum | GpioPinName { X0_0, X0_1, X0_2, X0_3, X0_4, X0_5, X0_6, X0_7, X1_0, X1_1, X1_2, X1_3, X1_4, X1_5, X1_6, X1_7, X0 = X0_0, X1 = X0_1, X2 = X0_2, X3 = X0_3, X4 = X0_4, X5 = X0_5, X6 = X0_6, X7 = X0_7, X8 = X1_0, X9 = X1_1, X10 = X1_2, X11 = X1_3, X12 = X1_4, X13 = X1_5, X14 = X1_6, X15 = X1_7, X_NC = ~0x0L } |
GPIO-Expander pin names. More... | |
Public Member Functions | |
GpioBusOut (CompGpioExp &gpiop, GpioPinName p0, GpioPinName p1=X_NC, GpioPinName p2=X_NC, GpioPinName p3=X_NC, GpioPinName p4=X_NC, GpioPinName p5=X_NC, GpioPinName p6=X_NC, GpioPinName p7=X_NC, GpioPinName p8=X_NC, GpioPinName p9=X_NC, GpioPinName p10=X_NC, GpioPinName p11=X_NC, GpioPinName p12=X_NC, GpioPinName p13=X_NC, GpioPinName p14=X_NC, GpioPinName p15=X_NC) | |
Create an GpioBusOut, connected to the specified pins. | |
virtual | ~GpioBusOut () |
Destractor. | |
GpioBusOut & | operator= (int rhs) |
A shorthand for write() | |
void | write (int value) |
Write the value to the output bus. | |
int | read () |
Read the value currently output on the bus. | |
void | output () |
Set as an output. | |
void | input () |
Set as an input. | |
operator int (void) | |
A shorthand for read() |
Detailed Description
GpioBusOut class.
"GpioBusOut" class works like "BusOut" class of mbed-SDK. This class provides pin oriented API, abstracting the GPIO-expander chip.
Example:
#include "mbed.h" #include "PCAL9555.h" PCAL9555 gpio_exp( p28, p27, 0xE8 ); // SDA, SCL, Slave_address(option) GpioBusOut mypins( gpio_exp, X0_0, X0_1, X0_2, X0_3 ); int main() { while( 1 ) { for( int i = 0; i < 16; i++ ) { mypins = i; wait( 0.25 ); } } }
Definition at line 41 of file GpioBusOut.h.
Member Enumeration Documentation
enum GpioPinName |
GPIO-Expander pin names.
- Enumerator:
Reimplemented from GpioBusInOut.
Definition at line 47 of file GpioBusOut.h.
Constructor & Destructor Documentation
GpioBusOut | ( | CompGpioExp & | gpiop, |
GpioPinName | p0, | ||
GpioPinName | p1 = X_NC , |
||
GpioPinName | p2 = X_NC , |
||
GpioPinName | p3 = X_NC , |
||
GpioPinName | p4 = X_NC , |
||
GpioPinName | p5 = X_NC , |
||
GpioPinName | p6 = X_NC , |
||
GpioPinName | p7 = X_NC , |
||
GpioPinName | p8 = X_NC , |
||
GpioPinName | p9 = X_NC , |
||
GpioPinName | p10 = X_NC , |
||
GpioPinName | p11 = X_NC , |
||
GpioPinName | p12 = X_NC , |
||
GpioPinName | p13 = X_NC , |
||
GpioPinName | p14 = X_NC , |
||
GpioPinName | p15 = X_NC |
||
) |
Create an GpioBusOut, connected to the specified pins.
- Parameters:
-
gpiop Instance of GPIO expander device p<n> DigitalInOut pin to connect to bus bit p<n> (GpioPinName)
- Note:
- It is only required to specify as many pin variables as is required for the bus; the rest will default to NC (not connected)
Definition at line 4 of file GpioBusOut.cpp.
~GpioBusOut | ( | ) | [virtual] |
Destractor.
Definition at line 22 of file GpioBusOut.cpp.
Member Function Documentation
void input | ( | void | ) | [inherited] |
Set as an input.
Definition at line 68 of file GpioBusInOut.cpp.
operator int | ( | void | ) | [inherited] |
GpioBusOut & operator= | ( | int | rhs ) |
A shorthand for write()
Reimplemented from GpioBusInOut.
Definition at line 26 of file GpioBusOut.cpp.
void output | ( | void | ) | [inherited] |
Set as an output.
Definition at line 63 of file GpioBusInOut.cpp.
int read | ( | void | ) | [inherited] |
Read the value currently output on the bus.
- Returns:
- An integer with each bit corresponding to associated DigitalInOut pin setting
Definition at line 50 of file GpioBusInOut.cpp.
void write | ( | int | value ) | [inherited] |
Write the value to the output bus.
- Parameters:
-
value An integer specifying a bit to write for every corresponding DigitalInOut pin
Definition at line 32 of file GpioBusInOut.cpp.
Generated on Tue Jul 12 2022 14:15:36 by
