mbed libraries for KL25Z

Dependents:   FRDM_RGBLED

Committer:
emilmont
Date:
Fri Oct 05 09:16:41 2012 +0000
Revision:
0:8024c367e29f
Child:
8:c14af7958ef5
First release of the mbed libraries for KL25Z

Who changed what in which revision?

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