Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions
BusIn Class Reference

A digital input bus, used for reading the state of a collection of pins. More...

#include <BusIn.h>

Inheritance diagram for BusIn:
NonCopyable< BusIn >

Public Member Functions

 BusIn (PinName p0, PinName p1=NC, PinName p2=NC, PinName p3=NC, PinName p4=NC, PinName p5=NC, PinName p6=NC, PinName p7=NC, PinName p8=NC, PinName p9=NC, PinName p10=NC, PinName p11=NC, PinName p12=NC, PinName p13=NC, PinName p14=NC, PinName p15=NC)
 Create an BusIn, connected to the specified pins. More...
 
 BusIn (PinName pins[16])
 Create an BusIn, connected to the specified pins. More...
 
int read ()
 Read the value of the input bus. More...
 
void mode (PinMode pull)
 Set the input pin mode. More...
 
int mask ()
 Binary mask of bus pins connected to actual pins (not NC pins) If bus pin is in NC state make corresponding bit will be cleared (set to 0), else bit will be set to 1. More...
 
 operator int ()
 A shorthand for read() More...
 
DigitalInoperator[] (int index)
 Access to particular bit in random-iterator fashion. More...
 

Detailed Description

A digital input bus, used for reading the state of a collection of pins.

Note
Synchronization level: Thread safe

Definition at line 33 of file BusIn.h.

Constructor & Destructor Documentation

BusIn ( PinName  p0,
PinName  p1 = NC,
PinName  p2 = NC,
PinName  p3 = NC,
PinName  p4 = NC,
PinName  p5 = NC,
PinName  p6 = NC,
PinName  p7 = NC,
PinName  p8 = NC,
PinName  p9 = NC,
PinName  p10 = NC,
PinName  p11 = NC,
PinName  p12 = NC,
PinName  p13 = NC,
PinName  p14 = NC,
PinName  p15 = NC 
)

Create an BusIn, connected to the specified pins.

Parameters
p0DigitalIn pin to connect to bus bit
p1DigitalIn pin to connect to bus bit
p2DigitalIn pin to connect to bus bit
p3DigitalIn pin to connect to bus bit
p4DigitalIn pin to connect to bus bit
p5DigitalIn pin to connect to bus bit
p6DigitalIn pin to connect to bus bit
p7DigitalIn pin to connect to bus bit
p8DigitalIn pin to connect to bus bit
p9DigitalIn pin to connect to bus bit
p10DigitalIn pin to connect to bus bit
p11DigitalIn pin to connect to bus bit
p12DigitalIn pin to connect to bus bit
p13DigitalIn pin to connect to bus bit
p14DigitalIn pin to connect to bus bit
p15DigitalIn pin to connect to bus bit
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)
BusIn ( PinName  pins[16])

Create an BusIn, connected to the specified pins.

Parameters
pinsAn array of pins to connect to bus bit

Member Function Documentation

int mask ( )

Binary mask of bus pins connected to actual pins (not NC pins) If bus pin is in NC state make corresponding bit will be cleared (set to 0), else bit will be set to 1.

Returns
Binary mask of connected pins

Definition at line 94 of file BusIn.h.

void mode ( PinMode  pull)

Set the input pin mode.

Parameters
pullPullUp, PullDown, PullNone
operator int ( )

A shorthand for read()

See also
DigitalIn::read()
DigitalIn& operator[] ( int  index)

Access to particular bit in random-iterator fashion.

Parameters
indexPosition of bit
int read ( )

Read the value of the input bus.

Returns
An integer with each bit corresponding to the value read from the associated DigitalIn pin
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.