mbed libraries for KL25Z

Dependents:   FRDM_RGBLED

Committer:
emilmont
Date:
Mon Feb 18 09:41:56 2013 +0000
Revision:
9:663789d7729f
Parent:
8:c14af7958ef5
Update mbed-KL25Z to latest build

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 9:663789d7729f 1 /* mbed Microcontroller Library
emilmont 9:663789d7729f 2 * Copyright (c) 2006-2013 ARM Limited
emilmont 9:663789d7729f 3 *
emilmont 9:663789d7729f 4 * Licensed under the Apache License, Version 2.0 (the "License");
emilmont 9:663789d7729f 5 * you may not use this file except in compliance with the License.
emilmont 9:663789d7729f 6 * You may obtain a copy of the License at
emilmont 9:663789d7729f 7 *
emilmont 9:663789d7729f 8 * http://www.apache.org/licenses/LICENSE-2.0
emilmont 9:663789d7729f 9 *
emilmont 9:663789d7729f 10 * Unless required by applicable law or agreed to in writing, software
emilmont 9:663789d7729f 11 * distributed under the License is distributed on an "AS IS" BASIS,
emilmont 9:663789d7729f 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
emilmont 9:663789d7729f 13 * See the License for the specific language governing permissions and
emilmont 9:663789d7729f 14 * limitations under the License.
emilmont 0:8024c367e29f 15 */
emilmont 0:8024c367e29f 16 #ifndef MBED_BUSOUT_H
emilmont 0:8024c367e29f 17 #define MBED_BUSOUT_H
emilmont 0:8024c367e29f 18
emilmont 0:8024c367e29f 19 #include "DigitalOut.h"
emilmont 0:8024c367e29f 20
emilmont 0:8024c367e29f 21 namespace mbed {
emilmont 0:8024c367e29f 22
emilmont 8:c14af7958ef5 23 /** A digital output bus, used for setting the state of a collection of pins
emilmont 0:8024c367e29f 24 */
emilmont 8:c14af7958ef5 25 class BusOut {
emilmont 0:8024c367e29f 26
emilmont 0:8024c367e29f 27 public:
emilmont 0:8024c367e29f 28
emilmont 8:c14af7958ef5 29 /** Create an BusOut, connected to the specified pins
emilmont 0:8024c367e29f 30 *
emilmont 8:c14af7958ef5 31 * @param p<n> DigitalOut pin to connect to bus bit <n> (p5-p30, NC)
emilmont 0:8024c367e29f 32 *
emilmont 8:c14af7958ef5 33 * @note
emilmont 0:8024c367e29f 34 * It is only required to specify as many pin variables as is required
emilmont 0:8024c367e29f 35 * for the bus; the rest will default to NC (not connected)
emilmont 9:663789d7729f 36 */
emilmont 0:8024c367e29f 37 BusOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
emilmont 0:8024c367e29f 38 PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
emilmont 0:8024c367e29f 39 PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
emilmont 8:c14af7958ef5 40 PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC);
emilmont 0:8024c367e29f 41
emilmont 8:c14af7958ef5 42 BusOut(PinName pins[16]);
emilmont 0:8024c367e29f 43
emilmont 0:8024c367e29f 44 virtual ~BusOut();
emilmont 0:8024c367e29f 45
emilmont 8:c14af7958ef5 46 /** Write the value to the output bus
emilmont 0:8024c367e29f 47 *
emilmont 8:c14af7958ef5 48 * @param value An integer specifying a bit to write for every corresponding DigitalOut pin
emilmont 0:8024c367e29f 49 */
emilmont 0:8024c367e29f 50 void write(int value);
emilmont 0:8024c367e29f 51
emilmont 8:c14af7958ef5 52 /** Read the value currently output on the bus
emilmont 0:8024c367e29f 53 *
emilmont 8:c14af7958ef5 54 * @returns
emilmont 8:c14af7958ef5 55 * An integer with each bit corresponding to associated DigitalOut pin setting
emilmont 0:8024c367e29f 56 */
emilmont 0:8024c367e29f 57 int read();
emilmont 0:8024c367e29f 58
emilmont 0:8024c367e29f 59 #ifdef MBED_OPERATORS
emilmont 8:c14af7958ef5 60 /** A shorthand for write()
emilmont 0:8024c367e29f 61 */
emilmont 0:8024c367e29f 62 BusOut& operator= (int v);
emilmont 0:8024c367e29f 63 BusOut& operator= (BusOut& rhs);
emilmont 0:8024c367e29f 64
emilmont 8:c14af7958ef5 65 /** A shorthand for read()
emilmont 0:8024c367e29f 66 */
emilmont 0:8024c367e29f 67 operator int();
emilmont 0:8024c367e29f 68 #endif
emilmont 0:8024c367e29f 69
emilmont 0:8024c367e29f 70 protected:
emilmont 0:8024c367e29f 71 DigitalOut* _pin[16];
emilmont 0:8024c367e29f 72 };
emilmont 0:8024c367e29f 73
emilmont 0:8024c367e29f 74 } // namespace mbed
emilmont 0:8024c367e29f 75
emilmont 0:8024c367e29f 76 #endif