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 - BusOut
emilmont 0:8024c367e29f 2 * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
emilmont 0:8024c367e29f 3 */
emilmont 0:8024c367e29f 4
emilmont 0:8024c367e29f 5 #ifndef MBED_BUSOUT_H
emilmont 0:8024c367e29f 6 #define MBED_BUSOUT_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 "DigitalOut.h"
emilmont 0:8024c367e29f 13
emilmont 0:8024c367e29f 14 namespace mbed {
emilmont 0:8024c367e29f 15
emilmont 0:8024c367e29f 16 /* Class: BusOut
emilmont 0:8024c367e29f 17 * A digital output bus, used for setting the state of a collection of pins
emilmont 0:8024c367e29f 18 */
emilmont 0:8024c367e29f 19 class BusOut : 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: BusOut
emilmont 0:8024c367e29f 26 * Create an BusOut, connected to the specified pins
emilmont 0:8024c367e29f 27 *
emilmont 0:8024c367e29f 28 * Variables:
emilmont 0:8024c367e29f 29 * p<n> - DigitalOut pin to connect to bus bit <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 BusOut(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 BusOut(PinName pins[16], const char *name = NULL);
emilmont 0:8024c367e29f 42
emilmont 0:8024c367e29f 43 virtual ~BusOut();
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 DigitalOut 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 DigitalOut pin setting
emilmont 0:8024c367e29f 61 */
emilmont 0:8024c367e29f 62 int read();
emilmont 0:8024c367e29f 63
emilmont 0:8024c367e29f 64 #ifdef MBED_OPERATORS
emilmont 0:8024c367e29f 65 /* Group: Access Method Shorthand */
emilmont 0:8024c367e29f 66
emilmont 0:8024c367e29f 67 /* Function: operator=
emilmont 0:8024c367e29f 68 * A shorthand for <write>
emilmont 0:8024c367e29f 69 */
emilmont 0:8024c367e29f 70 BusOut& operator= (int v);
emilmont 0:8024c367e29f 71 BusOut& operator= (BusOut& rhs);
emilmont 0:8024c367e29f 72
emilmont 0:8024c367e29f 73 /* Function: operator int()
emilmont 0:8024c367e29f 74 * A shorthand for <read>
emilmont 0:8024c367e29f 75 */
emilmont 0:8024c367e29f 76 operator int();
emilmont 0:8024c367e29f 77 #endif
emilmont 0:8024c367e29f 78
emilmont 0:8024c367e29f 79 #ifdef MBED_RPC
emilmont 0:8024c367e29f 80 virtual const struct rpc_method *get_rpc_methods();
emilmont 0:8024c367e29f 81 static struct rpc_class *get_rpc_class();
emilmont 0:8024c367e29f 82 #endif
emilmont 0:8024c367e29f 83
emilmont 0:8024c367e29f 84 protected:
emilmont 0:8024c367e29f 85
emilmont 0:8024c367e29f 86 DigitalOut* _pin[16];
emilmont 0:8024c367e29f 87
emilmont 0:8024c367e29f 88 #ifdef MBED_RPC
emilmont 0:8024c367e29f 89 static void construct(const char *arguments, char *res);
emilmont 0:8024c367e29f 90 #endif
emilmont 0:8024c367e29f 91
emilmont 0:8024c367e29f 92 };
emilmont 0:8024c367e29f 93
emilmont 0:8024c367e29f 94 } // namespace mbed
emilmont 0:8024c367e29f 95
emilmont 0:8024c367e29f 96 #endif
emilmont 0:8024c367e29f 97