re-enabling serial
[clinton/Smoothieware.git] / gcc4mbed / external / mbed / .svn / text-base / BusIn.h.svn-base
1 /* mbed Microcontroller Library - DigitalIn
2 * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
3 * sford, rmeyer
4 */
5
6 #ifndef MBED_BUSIN_H
7 #define MBED_BUSIN_H
8
9 #include "platform.h"
10 #include "PinNames.h"
11 #include "PeripheralNames.h"
12 #include "Base.h"
13 #include "DigitalIn.h"
14
15 namespace mbed {
16
17 /* Class: BusIn
18 * A digital input bus, used for reading the state of a collection of pins
19 */
20 class BusIn : public Base {
21
22 public:
23
24 /* Group: Configuration Methods */
25
26 /* Constructor: BusIn
27 * Create an BusIn, connected to the specified pins
28 *
29 * Variables:
30 * p<n> - DigitalIn pin to connect to bus bit <n> (p5-p30, NC)
31 *
32 * Note:
33 * It is only required to specify as many pin variables as is required
34 * for the bus; the rest will default to NC (not connected)
35 */
36 BusIn(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
37 PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
38 PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
39 PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC,
40 const char *name = NULL);
41
42 BusIn(PinName pins[16], const char *name = NULL);
43
44 virtual ~BusIn();
45
46 /* Group: Access Methods */
47
48 /* Function: read
49 * Read the value of the input bus
50 *
51 * Variables:
52 * returns - An integer with each bit corresponding to the value read from the associated DigitalIn pin
53 */
54 int read();
55
56 #ifdef MBED_OPERATORS
57 /* Group: Access Method Shorthand */
58
59 /* Function: operator int()
60 * A shorthand for <read>
61 */
62 operator int();
63 #endif
64
65 #ifdef MBED_RPC
66 virtual const struct rpc_method *get_rpc_methods();
67 static struct rpc_class *get_rpc_class();
68 #endif
69
70 protected:
71
72 DigitalIn* _pin[16];
73
74 #ifdef MBED_RPC
75 static void construct(const char *arguments, char *res);
76 #endif
77
78 };
79
80 } // namespace mbed
81
82 #endif
83