This is my quadcopter prototype software, still in development!

Committer:
Anaesthetix
Date:
Wed Jan 30 13:14:44 2013 +0000
Revision:
0:978110f7f027
My quadcopter prototype software, still in development.

Who changed what in which revision?

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