Fork of the official mbed C/C++ SDK provides the software platform and libraries to build your applications. The fork has the documentation converted to Doxygen format

Dependents:   NervousPuppySprintOne NervousPuppySprint2602 Robot WarehouseBot1 ... more

Fork of mbed by mbed official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BusOut.h Source File

BusOut.h

00001 /* mbed Microcontroller Library - BusOut
00002  * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
00003  */
00004  
00005 #ifndef MBED_BUSOUT_H
00006 #define MBED_BUSOUT_H
00007 
00008 #include "platform.h" 
00009 #include "PinNames.h"
00010 #include "PeripheralNames.h"
00011 #include "Base.h"
00012 #include "DigitalOut.h"
00013 
00014 namespace mbed {
00015 
00016 /** A digital output bus, used for setting the state of a collection of pins
00017  */
00018 class BusOut : public Base {
00019 
00020 public:
00021 
00022     /** Create an BusOut, connected to the specified pins
00023      *
00024      *  @param p<n> DigitalOut pin to connect to bus bit <n> (p5-p30, NC)
00025      *
00026      *  @note
00027      *    It is only required to specify as many pin variables as is required
00028      *    for the bus; the rest will default to NC (not connected)
00029      */ 
00030     BusOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
00031            PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
00032            PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
00033            PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC, 
00034            const char *name = NULL);
00035 
00036     BusOut(PinName pins[16], const char *name = NULL);
00037 
00038     virtual ~BusOut();
00039     
00040     /** Write the value to the output bus
00041      *
00042      *  @param value An integer specifying a bit to write for every corresponding DigitalOut pin
00043      */
00044     void write(int value);
00045 
00046         
00047     /** Read the value currently output on the bus
00048      *
00049      *  @returns
00050      *    An integer with each bit corresponding to associated DigitalOut pin setting
00051      */
00052     int read();
00053 
00054 #ifdef MBED_OPERATORS
00055        
00056     /** A shorthand for write()
00057      */
00058     BusOut& operator= (int v);
00059     BusOut& operator= (BusOut& rhs);
00060 
00061     /** A shorthand for read()
00062      */
00063     operator int();
00064 #endif
00065 
00066 #ifdef MBED_RPC
00067     virtual const struct rpc_method *get_rpc_methods();
00068     static struct rpc_class *get_rpc_class();
00069 #endif
00070 
00071 protected:
00072 
00073     DigitalOut* _pin[16];
00074 
00075 #ifdef MBED_RPC
00076     static void construct(const char *arguments, char *res);
00077 #endif
00078             
00079 };
00080 
00081 } // namespace mbed
00082 
00083 #endif
00084