svn / mbed / trunk / BusOut.h

Revision 29, 2.3 kB (checked in by emilmont, 6 months ago)

New Libraries 11.11

Line 
1/* mbed Microcontroller Library - BusOut
2 * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
3 */
4 
5#ifndef MBED_BUSOUT_H
6#define MBED_BUSOUT_H
7
8#include "platform.h"
9#include "PinNames.h"
10#include "PeripheralNames.h"
11#include "Base.h"
12#include "DigitalOut.h"
13
14namespace mbed {
15
16/* Class: BusOut
17 *  A digital output bus, used for setting the state of a collection of pins
18 */
19class BusOut : public Base {
20
21public:
22
23    /* Group: Configuration Methods */
24
25    /* Constructor: BusOut
26     *  Create an BusOut, connected to the specified pins
27     *
28     * Variables:
29     *  p<n> - DigitalOut pin to connect to bus bit <n> (p5-p30, NC)
30     *
31     * Note:
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)
34     */ 
35    BusOut(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);
40
41    BusOut(PinName pins[16], const char *name = NULL);
42
43    virtual ~BusOut();
44
45    /* Group: Access Methods */
46       
47    /* Function: write
48     *  Write the value to the output bus
49     *
50     * Variables:
51     *  value - An integer specifying a bit to write for every corresponding DigitalOut pin
52     */
53    void write(int value);
54
55       
56    /* Function: read
57     *  Read the value currently output on the bus
58     *
59     * Variables:
60     *  returns - An integer with each bit corresponding to associated DigitalOut pin setting
61     */
62    int read();
63
64#ifdef MBED_OPERATORS
65    /* Group: Access Method Shorthand */
66       
67    /* Function: operator=
68     *  A shorthand for <write>
69     */
70    BusOut& operator= (int v);
71    BusOut& operator= (BusOut& rhs);
72
73    /* Function: operator int()
74     *  A shorthand for <read>
75     */
76    operator int();
77#endif
78
79#ifdef MBED_RPC
80    virtual const struct rpc_method *get_rpc_methods();
81    static struct rpc_class *get_rpc_class();
82#endif
83
84protected:
85
86    DigitalOut* _pin[16];
87
88#ifdef MBED_RPC
89    static void construct(const char *arguments, char *res);
90#endif
91           
92};
93
94} // namespace mbed
95
96#endif
97
Note: See TracBrowser for help on using the browser.