mbed(SerialHalfDuplex入り)
Fork of mbed by
BusIn.h@64:e3affc9e7238, 2013-08-05 (annotated)
- Committer:
- bogdanm
- Date:
- Mon Aug 05 12:28:09 2013 +0300
- Revision:
- 64:e3affc9e7238
- Parent:
- 59:0883845fe643
- Child:
- 65:5798e58a58b1
New build system structure, new target (LPC1347), bug fixes (I2C read/write errors, LPC11U24 memory map and others)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 44:24d45a770a51 | 1 | /* mbed Microcontroller Library |
emilmont | 54:71b101360fb9 | 2 | * Copyright (c) 2006-2013 ARM Limited |
emilmont | 44:24d45a770a51 | 3 | * |
emilmont | 59:0883845fe643 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
emilmont | 59:0883845fe643 | 5 | * you may not use this file except in compliance with the License. |
emilmont | 59:0883845fe643 | 6 | * You may obtain a copy of the License at |
emilmont | 59:0883845fe643 | 7 | * |
emilmont | 59:0883845fe643 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
emilmont | 44:24d45a770a51 | 9 | * |
emilmont | 59:0883845fe643 | 10 | * Unless required by applicable law or agreed to in writing, software |
emilmont | 59:0883845fe643 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
emilmont | 59:0883845fe643 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
emilmont | 59:0883845fe643 | 13 | * See the License for the specific language governing permissions and |
emilmont | 59:0883845fe643 | 14 | * limitations under the License. |
simon.ford@mbed.co.uk | 0:82220227f4fa | 15 | */ |
simon.ford@mbed.co.uk | 0:82220227f4fa | 16 | #ifndef MBED_BUSIN_H |
simon.ford@mbed.co.uk | 0:82220227f4fa | 17 | #define MBED_BUSIN_H |
simon.ford@mbed.co.uk | 0:82220227f4fa | 18 | |
rolf.meyer@arm.com | 11:1c1ebd0324fa | 19 | #include "platform.h" |
simon.ford@mbed.co.uk | 0:82220227f4fa | 20 | #include "DigitalIn.h" |
simon.ford@mbed.co.uk | 0:82220227f4fa | 21 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 22 | namespace mbed { |
simon.ford@mbed.co.uk | 0:82220227f4fa | 23 | |
emilmont | 43:e2ed12d17f06 | 24 | /** A digital input bus, used for reading the state of a collection of pins |
simon.ford@mbed.co.uk | 0:82220227f4fa | 25 | */ |
emilmont | 44:24d45a770a51 | 26 | class BusIn { |
simon.ford@mbed.co.uk | 0:82220227f4fa | 27 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 28 | public: |
emilmont | 44:24d45a770a51 | 29 | /* Group: Configuration Methods */ |
simon.ford@mbed.co.uk | 0:82220227f4fa | 30 | |
emilmont | 43:e2ed12d17f06 | 31 | /** Create an BusIn, connected to the specified pins |
rolf.meyer@arm.com | 11:1c1ebd0324fa | 32 | * |
emilmont | 43:e2ed12d17f06 | 33 | * @param <n> DigitalIn pin to connect to bus bit <n> (p5-p30, NC) |
simon.ford@mbed.co.uk | 0:82220227f4fa | 34 | * |
emilmont | 43:e2ed12d17f06 | 35 | * @note |
simon.ford@mbed.co.uk | 0:82220227f4fa | 36 | * It is only required to specify as many pin variables as is required |
rolf.meyer@arm.com | 11:1c1ebd0324fa | 37 | * for the bus; the rest will default to NC (not connected) |
emilmont | 55:d722ed6a4237 | 38 | */ |
rolf.meyer@arm.com | 11:1c1ebd0324fa | 39 | BusIn(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC, |
rolf.meyer@arm.com | 11:1c1ebd0324fa | 40 | PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC, |
rolf.meyer@arm.com | 11:1c1ebd0324fa | 41 | PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC, |
emilmont | 44:24d45a770a51 | 42 | PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC); |
simon.ford@mbed.co.uk | 5:62573be585e9 | 43 | |
emilmont | 44:24d45a770a51 | 44 | BusIn(PinName pins[16]); |
emilmont | 55:d722ed6a4237 | 45 | |
emilmont | 43:e2ed12d17f06 | 46 | virtual ~BusIn(); |
emilmont | 55:d722ed6a4237 | 47 | |
emilmont | 43:e2ed12d17f06 | 48 | /** Read the value of the input bus |
emilmont | 43:e2ed12d17f06 | 49 | * |
emilmont | 43:e2ed12d17f06 | 50 | * @returns |
emilmont | 43:e2ed12d17f06 | 51 | * An integer with each bit corresponding to the value read from the associated DigitalIn pin |
emilmont | 43:e2ed12d17f06 | 52 | */ |
simon.ford@mbed.co.uk | 0:82220227f4fa | 53 | int read(); |
rolf.meyer@arm.com | 11:1c1ebd0324fa | 54 | |
rolf.meyer@arm.com | 11:1c1ebd0324fa | 55 | #ifdef MBED_OPERATORS |
emilmont | 43:e2ed12d17f06 | 56 | /** A shorthand for read() |
rolf.meyer@arm.com | 11:1c1ebd0324fa | 57 | */ |
rolf.meyer@arm.com | 11:1c1ebd0324fa | 58 | operator int(); |
rolf.meyer@arm.com | 11:1c1ebd0324fa | 59 | #endif |
simon.ford@mbed.co.uk | 4:5d1359a283bc | 60 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 61 | protected: |
rolf.meyer@arm.com | 11:1c1ebd0324fa | 62 | DigitalIn* _pin[16]; |
simon.ford@mbed.co.uk | 0:82220227f4fa | 63 | }; |
simon.ford@mbed.co.uk | 0:82220227f4fa | 64 | |
rolf.meyer@arm.com | 11:1c1ebd0324fa | 65 | } // namespace mbed |
simon.ford@mbed.co.uk | 0:82220227f4fa | 66 | |
simon.ford@mbed.co.uk | 1:6b7f447ca868 | 67 | #endif |