SD card interface

Committer:
lharoon
Date:
Mon Oct 08 11:14:07 2012 +0000
Revision:
0:22612ae617a0
1st edition

Who changed what in which revision?

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