Library

Dependents:   OSCTest_2

Fork of mbed by gokmen ascioglu

Committer:
itotaka
Date:
Fri Oct 04 12:17:02 2013 +0000
Revision:
1:b749145a7bb1
Parent:
0:a8fa94490a0a
changed Max_Arg to 80

Who changed what in which revision?

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