printer

Dependents:   Good_Serial_HelloWorld_Mbed

Fork of mbed by gokmen ascioglu

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BusIn.h Source File

BusIn.h

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