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 - BusInOut
lharoon 0:22612ae617a0 2 * Copyright (c) 2009 ARM Limited. All rights reserved.
lharoon 0:22612ae617a0 3 */
lharoon 0:22612ae617a0 4
lharoon 0:22612ae617a0 5 #ifndef MBED_BUSINOUT_H
lharoon 0:22612ae617a0 6 #define MBED_BUSINOUT_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 "DigitalInOut.h"
lharoon 0:22612ae617a0 13
lharoon 0:22612ae617a0 14 namespace mbed {
lharoon 0:22612ae617a0 15
lharoon 0:22612ae617a0 16 /* Class: BusInOut
lharoon 0:22612ae617a0 17 * A digital input output bus, used for setting the state of a collection of pins
lharoon 0:22612ae617a0 18 */
lharoon 0:22612ae617a0 19 class BusInOut : 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: BusInOut
lharoon 0:22612ae617a0 26 * Create an BusInOut, connected to the specified pins
lharoon 0:22612ae617a0 27 *
lharoon 0:22612ae617a0 28 * Variables:
lharoon 0:22612ae617a0 29 * p<n> - DigitalInOut pin to connect to bus bit p<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 BusInOut(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 BusInOut(PinName pins[16], const char *name = NULL);
lharoon 0:22612ae617a0 42
lharoon 0:22612ae617a0 43 virtual ~BusInOut();
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 DigitalInOut 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 DigitalInOut pin setting
lharoon 0:22612ae617a0 61 */
lharoon 0:22612ae617a0 62 int read();
lharoon 0:22612ae617a0 63
lharoon 0:22612ae617a0 64 /* Function: output
lharoon 0:22612ae617a0 65 * Set as an output
lharoon 0:22612ae617a0 66 */
lharoon 0:22612ae617a0 67 void output();
lharoon 0:22612ae617a0 68
lharoon 0:22612ae617a0 69 /* Function: input
lharoon 0:22612ae617a0 70 * Set as an input
lharoon 0:22612ae617a0 71 */
lharoon 0:22612ae617a0 72 void input();
lharoon 0:22612ae617a0 73
lharoon 0:22612ae617a0 74 /* Function: mode
lharoon 0:22612ae617a0 75 * Set the input pin mode
lharoon 0:22612ae617a0 76 *
lharoon 0:22612ae617a0 77 * Variables:
lharoon 0:22612ae617a0 78 * mode - PullUp, PullDown, PullNone
lharoon 0:22612ae617a0 79 */
lharoon 0:22612ae617a0 80 void mode(PinMode pull);
lharoon 0:22612ae617a0 81
lharoon 0:22612ae617a0 82 #ifdef MBED_OPERATORS
lharoon 0:22612ae617a0 83 /* Group: Access Method Shorthand */
lharoon 0:22612ae617a0 84
lharoon 0:22612ae617a0 85 /* Function: operator=
lharoon 0:22612ae617a0 86 * A shorthand for <write>
lharoon 0:22612ae617a0 87 */
lharoon 0:22612ae617a0 88 BusInOut& operator= (int v);
lharoon 0:22612ae617a0 89 BusInOut& operator= (BusInOut& rhs);
lharoon 0:22612ae617a0 90
lharoon 0:22612ae617a0 91 /* Function: operator int()
lharoon 0:22612ae617a0 92 * A shorthand for <read>
lharoon 0:22612ae617a0 93 */
lharoon 0:22612ae617a0 94 operator int();
lharoon 0:22612ae617a0 95 #endif
lharoon 0:22612ae617a0 96
lharoon 0:22612ae617a0 97 #ifdef MBED_RPC
lharoon 0:22612ae617a0 98 virtual const struct rpc_method *get_rpc_methods();
lharoon 0:22612ae617a0 99 static struct rpc_class *get_rpc_class();
lharoon 0:22612ae617a0 100 #endif
lharoon 0:22612ae617a0 101
lharoon 0:22612ae617a0 102 protected:
lharoon 0:22612ae617a0 103
lharoon 0:22612ae617a0 104 DigitalInOut* _pin[16];
lharoon 0:22612ae617a0 105
lharoon 0:22612ae617a0 106 #ifdef MBED_RPC
lharoon 0:22612ae617a0 107 static void construct(const char *arguments, char *res);
lharoon 0:22612ae617a0 108 #endif
lharoon 0:22612ae617a0 109
lharoon 0:22612ae617a0 110 };
lharoon 0:22612ae617a0 111
lharoon 0:22612ae617a0 112 } // namespace mbed
lharoon 0:22612ae617a0 113
lharoon 0:22612ae617a0 114 #endif
lharoon 0:22612ae617a0 115