mbed libraries for KL25Z

Dependents:   FRDM_RGBLED

Committer:
emilmont
Date:
Fri Nov 09 11:33:53 2012 +0000
Revision:
8:c14af7958ef5
Parent:
0:8024c367e29f
Child:
9:663789d7729f
SPI driver; ADC driver; DAC driver; microlib support; general bugfixing

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 #ifndef MBED_BUSOUT_H
emilmont 0:8024c367e29f 5 #define MBED_BUSOUT_H
emilmont 0:8024c367e29f 6
emilmont 0:8024c367e29f 7 #include "DigitalOut.h"
emilmont 0:8024c367e29f 8
emilmont 0:8024c367e29f 9 namespace mbed {
emilmont 0:8024c367e29f 10
emilmont 8:c14af7958ef5 11 /** A digital output bus, used for setting the state of a collection of pins
emilmont 0:8024c367e29f 12 */
emilmont 8:c14af7958ef5 13 class BusOut {
emilmont 0:8024c367e29f 14
emilmont 0:8024c367e29f 15 public:
emilmont 0:8024c367e29f 16
emilmont 8:c14af7958ef5 17 /** Create an BusOut, connected to the specified pins
emilmont 0:8024c367e29f 18 *
emilmont 8:c14af7958ef5 19 * @param p<n> DigitalOut pin to connect to bus bit <n> (p5-p30, NC)
emilmont 0:8024c367e29f 20 *
emilmont 8:c14af7958ef5 21 * @note
emilmont 0:8024c367e29f 22 * It is only required to specify as many pin variables as is required
emilmont 0:8024c367e29f 23 * for the bus; the rest will default to NC (not connected)
emilmont 0:8024c367e29f 24 */
emilmont 0:8024c367e29f 25 BusOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
emilmont 0:8024c367e29f 26 PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
emilmont 0:8024c367e29f 27 PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
emilmont 8:c14af7958ef5 28 PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC);
emilmont 0:8024c367e29f 29
emilmont 8:c14af7958ef5 30 BusOut(PinName pins[16]);
emilmont 0:8024c367e29f 31
emilmont 0:8024c367e29f 32 virtual ~BusOut();
emilmont 0:8024c367e29f 33
emilmont 8:c14af7958ef5 34 /** Write the value to the output bus
emilmont 0:8024c367e29f 35 *
emilmont 8:c14af7958ef5 36 * @param value An integer specifying a bit to write for every corresponding DigitalOut pin
emilmont 0:8024c367e29f 37 */
emilmont 0:8024c367e29f 38 void write(int value);
emilmont 0:8024c367e29f 39
emilmont 8:c14af7958ef5 40 /** Read the value currently output on the bus
emilmont 0:8024c367e29f 41 *
emilmont 8:c14af7958ef5 42 * @returns
emilmont 8:c14af7958ef5 43 * An integer with each bit corresponding to associated DigitalOut pin setting
emilmont 0:8024c367e29f 44 */
emilmont 0:8024c367e29f 45 int read();
emilmont 0:8024c367e29f 46
emilmont 0:8024c367e29f 47 #ifdef MBED_OPERATORS
emilmont 8:c14af7958ef5 48 /** A shorthand for write()
emilmont 0:8024c367e29f 49 */
emilmont 0:8024c367e29f 50 BusOut& operator= (int v);
emilmont 0:8024c367e29f 51 BusOut& operator= (BusOut& rhs);
emilmont 0:8024c367e29f 52
emilmont 8:c14af7958ef5 53 /** A shorthand for read()
emilmont 0:8024c367e29f 54 */
emilmont 0:8024c367e29f 55 operator int();
emilmont 0:8024c367e29f 56 #endif
emilmont 0:8024c367e29f 57
emilmont 0:8024c367e29f 58 protected:
emilmont 0:8024c367e29f 59 DigitalOut* _pin[16];
emilmont 0:8024c367e29f 60 };
emilmont 0:8024c367e29f 61
emilmont 0:8024c367e29f 62 } // namespace mbed
emilmont 0:8024c367e29f 63
emilmont 0:8024c367e29f 64 #endif