7355edb2c05da71958f69ce8f0454b9007d6aec3
1 /* mbed Microcontroller Library - BusInOut
2 * Copyright (c) 2009 ARM Limited. All rights reserved.
5 #ifndef MBED_BUSINOUT_H
6 #define MBED_BUSINOUT_H
10 #include "PeripheralNames.h"
12 #include "DigitalInOut.h"
17 * A digital input output bus, used for setting the state of a collection of pins
19 class BusInOut
: public Base
{
23 /* Group: Configuration Methods */
25 /* Constructor: BusInOut
26 * Create an BusInOut, connected to the specified pins
29 * p<n> - DigitalInOut pin to connect to bus bit p<n> (p5-p30, NC)
32 * It is only required to specify as many pin variables as is required
33 * for the bus; the rest will default to NC (not connected)
35 BusInOut(PinName p0
, PinName p1
= NC
, PinName p2
= NC
, PinName p3
= NC
,
36 PinName p4
= NC
, PinName p5
= NC
, PinName p6
= NC
, PinName p7
= NC
,
37 PinName p8
= NC
, PinName p9
= NC
, PinName p10
= NC
, PinName p11
= NC
,
38 PinName p12
= NC
, PinName p13
= NC
, PinName p14
= NC
, PinName p15
= NC
,
39 const char *name
= NULL
);
41 BusInOut(PinName pins
[16], const char *name
= NULL
);
45 /* Group: Access Methods */
48 * Write the value to the output bus
51 * value - An integer specifying a bit to write for every corresponding DigitalInOut pin
53 void write(int value
);
57 * Read the value currently output on the bus
60 * returns - An integer with each bit corresponding to associated DigitalInOut pin setting
75 * Set the input pin mode
78 * mode - PullUp, PullDown, PullNone
80 void mode(PinMode pull
);
83 /* Group: Access Method Shorthand */
85 /* Function: operator=
86 * A shorthand for <write>
88 BusInOut
& operator= (int v
);
89 BusInOut
& operator= (BusInOut
& rhs
);
91 /* Function: operator int()
92 * A shorthand for <read>
98 virtual const struct rpc_method
*get_rpc_methods();
99 static struct rpc_class
*get_rpc_class();
104 DigitalInOut
* _pin
[16];
107 static void construct(const char *arguments
, char *res
);