mbed libraries for KL25Z
BusIn.h@9:663789d7729f, 2013-02-18 (annotated)
- 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?
User | Revision | Line number | New 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_BUSIN_H |
emilmont | 0:8024c367e29f | 17 | #define MBED_BUSIN_H |
emilmont | 0:8024c367e29f | 18 | |
emilmont | 0:8024c367e29f | 19 | #include "platform.h" |
emilmont | 0:8024c367e29f | 20 | #include "DigitalIn.h" |
emilmont | 0:8024c367e29f | 21 | |
emilmont | 0:8024c367e29f | 22 | namespace mbed { |
emilmont | 0:8024c367e29f | 23 | |
emilmont | 8:c14af7958ef5 | 24 | /** A digital input bus, used for reading the state of a collection of pins |
emilmont | 0:8024c367e29f | 25 | */ |
emilmont | 8:c14af7958ef5 | 26 | class BusIn { |
emilmont | 0:8024c367e29f | 27 | |
emilmont | 0:8024c367e29f | 28 | public: |
emilmont | 0:8024c367e29f | 29 | /* Group: Configuration Methods */ |
emilmont | 0:8024c367e29f | 30 | |
emilmont | 8:c14af7958ef5 | 31 | /** Create an BusIn, connected to the specified pins |
emilmont | 0:8024c367e29f | 32 | * |
emilmont | 8:c14af7958ef5 | 33 | * @param <n> DigitalIn pin to connect to bus bit <n> (p5-p30, NC) |
emilmont | 0:8024c367e29f | 34 | * |
emilmont | 8:c14af7958ef5 | 35 | * @note |
emilmont | 0:8024c367e29f | 36 | * It is only required to specify as many pin variables as is required |
emilmont | 0:8024c367e29f | 37 | * for the bus; the rest will default to NC (not connected) |
emilmont | 9:663789d7729f | 38 | */ |
emilmont | 0:8024c367e29f | 39 | BusIn(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC, |
emilmont | 0:8024c367e29f | 40 | PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC, |
emilmont | 0:8024c367e29f | 41 | PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC, |
emilmont | 8:c14af7958ef5 | 42 | PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC); |
emilmont | 0:8024c367e29f | 43 | |
emilmont | 8:c14af7958ef5 | 44 | BusIn(PinName pins[16]); |
emilmont | 9:663789d7729f | 45 | |
emilmont | 0:8024c367e29f | 46 | virtual ~BusIn(); |
emilmont | 9:663789d7729f | 47 | |
emilmont | 8:c14af7958ef5 | 48 | /** Read the value of the input bus |
emilmont | 0:8024c367e29f | 49 | * |
emilmont | 8:c14af7958ef5 | 50 | * @returns |
emilmont | 8:c14af7958ef5 | 51 | * An integer with each bit corresponding to the value read from the associated DigitalIn pin |
emilmont | 0:8024c367e29f | 52 | */ |
emilmont | 0:8024c367e29f | 53 | int read(); |
emilmont | 0:8024c367e29f | 54 | |
emilmont | 0:8024c367e29f | 55 | #ifdef MBED_OPERATORS |
emilmont | 8:c14af7958ef5 | 56 | /** A shorthand for read() |
emilmont | 0:8024c367e29f | 57 | */ |
emilmont | 0:8024c367e29f | 58 | operator int(); |
emilmont | 0:8024c367e29f | 59 | #endif |
emilmont | 0:8024c367e29f | 60 | |
emilmont | 0:8024c367e29f | 61 | protected: |
emilmont | 0:8024c367e29f | 62 | DigitalIn* _pin[16]; |
emilmont | 0:8024c367e29f | 63 | }; |
emilmont | 0:8024c367e29f | 64 | |
emilmont | 0:8024c367e29f | 65 | } // namespace mbed |
emilmont | 0:8024c367e29f | 66 | |
emilmont | 0:8024c367e29f | 67 | #endif |