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_BUSINOUT_H
emilmont 0:8024c367e29f 17 #define MBED_BUSINOUT_H
emilmont 0:8024c367e29f 18
emilmont 0:8024c367e29f 19 #include "DigitalInOut.h"
emilmont 0:8024c367e29f 20
emilmont 0:8024c367e29f 21 namespace mbed {
emilmont 0:8024c367e29f 22
emilmont 8:c14af7958ef5 23 /** A digital input output bus, used for setting the state of a collection of pins
emilmont 0:8024c367e29f 24 */
emilmont 8:c14af7958ef5 25 class BusInOut {
emilmont 0:8024c367e29f 26
emilmont 0:8024c367e29f 27 public:
emilmont 9:663789d7729f 28
emilmont 8:c14af7958ef5 29 /** Create an BusInOut, connected to the specified pins
emilmont 0:8024c367e29f 30 *
emilmont 8:c14af7958ef5 31 * @param p<n> DigitalInOut pin to connect to bus bit p<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 BusInOut(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 BusInOut(PinName pins[16]);
emilmont 0:8024c367e29f 43
emilmont 0:8024c367e29f 44 virtual ~BusInOut();
emilmont 0:8024c367e29f 45
emilmont 0:8024c367e29f 46 /* Group: Access Methods */
emilmont 8:c14af7958ef5 47
emilmont 8:c14af7958ef5 48 /** Write the value to the output bus
emilmont 0:8024c367e29f 49 *
emilmont 8:c14af7958ef5 50 * @param value An integer specifying a bit to write for every corresponding DigitalInOut pin
emilmont 0:8024c367e29f 51 */
emilmont 0:8024c367e29f 52 void write(int value);
emilmont 0:8024c367e29f 53
emilmont 9:663789d7729f 54
emilmont 8:c14af7958ef5 55 /** Read the value currently output on the bus
emilmont 0:8024c367e29f 56 *
emilmont 8:c14af7958ef5 57 * @returns
emilmont 8:c14af7958ef5 58 * An integer with each bit corresponding to associated DigitalInOut pin setting
emilmont 0:8024c367e29f 59 */
emilmont 0:8024c367e29f 60 int read();
emilmont 0:8024c367e29f 61
emilmont 8:c14af7958ef5 62 /** Set as an output
emilmont 0:8024c367e29f 63 */
emilmont 0:8024c367e29f 64 void output();
emilmont 0:8024c367e29f 65
emilmont 8:c14af7958ef5 66 /** Set as an input
emilmont 0:8024c367e29f 67 */
emilmont 0:8024c367e29f 68 void input();
emilmont 0:8024c367e29f 69
emilmont 8:c14af7958ef5 70 /** Set the input pin mode
emilmont 0:8024c367e29f 71 *
emilmont 8:c14af7958ef5 72 * @param mode PullUp, PullDown, PullNone
emilmont 0:8024c367e29f 73 */
emilmont 0:8024c367e29f 74 void mode(PinMode pull);
emilmont 9:663789d7729f 75
emilmont 0:8024c367e29f 76 #ifdef MBED_OPERATORS
emilmont 8:c14af7958ef5 77 /** A shorthand for write()
emilmont 0:8024c367e29f 78 */
emilmont 0:8024c367e29f 79 BusInOut& operator= (int v);
emilmont 0:8024c367e29f 80 BusInOut& operator= (BusInOut& rhs);
emilmont 0:8024c367e29f 81
emilmont 8:c14af7958ef5 82 /** A shorthand for read()
emilmont 0:8024c367e29f 83 */
emilmont 0:8024c367e29f 84 operator int();
emilmont 0:8024c367e29f 85 #endif
emilmont 0:8024c367e29f 86
emilmont 0:8024c367e29f 87 protected:
emilmont 0:8024c367e29f 88 DigitalInOut* _pin[16];
emilmont 0:8024c367e29f 89 };
emilmont 0:8024c367e29f 90
emilmont 0:8024c367e29f 91 } // namespace mbed
emilmont 0:8024c367e29f 92
emilmont 0:8024c367e29f 93 #endif