Recently changed pages
Jobs Jobs
Debugging Debugging
mbed NXP LPC1768 mbed NXP LPC1768
Homepage Homepage
Compiler Tour Compiler Tour
Media Media
Serial Serial
From the mbed microcontroller Handbook.

BusIn

/media/uploads/mbedofficial/digitalin_interfaces.png

The BusIn interface is used to create a number of DigitalIn pins that can be read as one value.

Any of the numbered mbed pins can be used as a DigitalIn in the BusIn.

Hello World!

Control all the LEDs as a single value

#include "mbed.h"

BusIn nibble(p5, p6, p18, p11);

int main() {
    while(1) {
        switch(nibble) {
            case 0x3: printf("Hello!\n"); break; // p5 and p6 are 1
            case 0x8: printf("World!\n"); break; // p11 is 1
        }
    }
}

API

API summary

BusInA digital input bus, used for reading the state of a collection of pins
Configuration Methods
BusInCreate an BusIn, connected to the specified pins
Access Methods
readRead the value of the input bus
Access Method Shorthand
operator int()A shorthand for read
class BusIn : public Base
A digital input bus, used for reading the state of a collection of pins
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,
const char *name =  NULL)
Create an BusIn, connected to the specified pins
int read()
Read the value of the input bus
operator int()
A shorthand for read

Related




calendar Page history
Last modified 21 Jul 2010, by user avatar Dan Ros   tag No tags | 0 replies     Share: Digg Tweet This

Please login to post comments.