mbed SDK library sources
Fork of mbed-src by
Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.
If you are looking for a stable and tested release, please import one of the official mbed library releases:
Import librarymbed
The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
api/BusOut.h@47:02833c62d054, 2013-11-21 (annotated)
- Committer:
- mbed_official
- Date:
- Thu Nov 21 10:00:05 2013 +0000
- Revision:
- 47:02833c62d054
- Parent:
- 13:0645d8841f51
Synchronized with git revision 6a5335a40ed97c7edd719e209bda5f3b5d9d997e
Full URL: https://github.com/mbedmicro/mbed/commit/6a5335a40ed97c7edd719e209bda5f3b5d9d997e/
Added sleep to LPC81x
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 13:0645d8841f51 | 1 | /* mbed Microcontroller Library |
bogdanm | 13:0645d8841f51 | 2 | * Copyright (c) 2006-2013 ARM Limited |
bogdanm | 13:0645d8841f51 | 3 | * |
bogdanm | 13:0645d8841f51 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
bogdanm | 13:0645d8841f51 | 5 | * you may not use this file except in compliance with the License. |
bogdanm | 13:0645d8841f51 | 6 | * You may obtain a copy of the License at |
bogdanm | 13:0645d8841f51 | 7 | * |
bogdanm | 13:0645d8841f51 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
bogdanm | 13:0645d8841f51 | 9 | * |
bogdanm | 13:0645d8841f51 | 10 | * Unless required by applicable law or agreed to in writing, software |
bogdanm | 13:0645d8841f51 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
bogdanm | 13:0645d8841f51 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
bogdanm | 13:0645d8841f51 | 13 | * See the License for the specific language governing permissions and |
bogdanm | 13:0645d8841f51 | 14 | * limitations under the License. |
bogdanm | 13:0645d8841f51 | 15 | */ |
bogdanm | 13:0645d8841f51 | 16 | #ifndef MBED_BUSOUT_H |
bogdanm | 13:0645d8841f51 | 17 | #define MBED_BUSOUT_H |
bogdanm | 13:0645d8841f51 | 18 | |
bogdanm | 13:0645d8841f51 | 19 | #include "DigitalOut.h" |
bogdanm | 13:0645d8841f51 | 20 | |
bogdanm | 13:0645d8841f51 | 21 | namespace mbed { |
bogdanm | 13:0645d8841f51 | 22 | |
bogdanm | 13:0645d8841f51 | 23 | /** A digital output bus, used for setting the state of a collection of pins |
bogdanm | 13:0645d8841f51 | 24 | */ |
bogdanm | 13:0645d8841f51 | 25 | class BusOut { |
bogdanm | 13:0645d8841f51 | 26 | |
bogdanm | 13:0645d8841f51 | 27 | public: |
bogdanm | 13:0645d8841f51 | 28 | |
bogdanm | 13:0645d8841f51 | 29 | /** Create an BusOut, connected to the specified pins |
bogdanm | 13:0645d8841f51 | 30 | * |
bogdanm | 13:0645d8841f51 | 31 | * @param p<n> DigitalOut pin to connect to bus bit <n> (p5-p30, NC) |
bogdanm | 13:0645d8841f51 | 32 | * |
bogdanm | 13:0645d8841f51 | 33 | * @note |
bogdanm | 13:0645d8841f51 | 34 | * It is only required to specify as many pin variables as is required |
bogdanm | 13:0645d8841f51 | 35 | * for the bus; the rest will default to NC (not connected) |
bogdanm | 13:0645d8841f51 | 36 | */ |
bogdanm | 13:0645d8841f51 | 37 | BusOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC, |
bogdanm | 13:0645d8841f51 | 38 | PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC, |
bogdanm | 13:0645d8841f51 | 39 | PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC, |
bogdanm | 13:0645d8841f51 | 40 | PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC); |
bogdanm | 13:0645d8841f51 | 41 | |
bogdanm | 13:0645d8841f51 | 42 | BusOut(PinName pins[16]); |
bogdanm | 13:0645d8841f51 | 43 | |
bogdanm | 13:0645d8841f51 | 44 | virtual ~BusOut(); |
bogdanm | 13:0645d8841f51 | 45 | |
bogdanm | 13:0645d8841f51 | 46 | /** Write the value to the output bus |
bogdanm | 13:0645d8841f51 | 47 | * |
bogdanm | 13:0645d8841f51 | 48 | * @param value An integer specifying a bit to write for every corresponding DigitalOut pin |
bogdanm | 13:0645d8841f51 | 49 | */ |
bogdanm | 13:0645d8841f51 | 50 | void write(int value); |
bogdanm | 13:0645d8841f51 | 51 | |
bogdanm | 13:0645d8841f51 | 52 | /** Read the value currently output on the bus |
bogdanm | 13:0645d8841f51 | 53 | * |
bogdanm | 13:0645d8841f51 | 54 | * @returns |
bogdanm | 13:0645d8841f51 | 55 | * An integer with each bit corresponding to associated DigitalOut pin setting |
bogdanm | 13:0645d8841f51 | 56 | */ |
bogdanm | 13:0645d8841f51 | 57 | int read(); |
bogdanm | 13:0645d8841f51 | 58 | |
bogdanm | 13:0645d8841f51 | 59 | #ifdef MBED_OPERATORS |
bogdanm | 13:0645d8841f51 | 60 | /** A shorthand for write() |
bogdanm | 13:0645d8841f51 | 61 | */ |
bogdanm | 13:0645d8841f51 | 62 | BusOut& operator= (int v); |
bogdanm | 13:0645d8841f51 | 63 | BusOut& operator= (BusOut& rhs); |
bogdanm | 13:0645d8841f51 | 64 | |
bogdanm | 13:0645d8841f51 | 65 | /** A shorthand for read() |
bogdanm | 13:0645d8841f51 | 66 | */ |
bogdanm | 13:0645d8841f51 | 67 | operator int(); |
bogdanm | 13:0645d8841f51 | 68 | #endif |
bogdanm | 13:0645d8841f51 | 69 | |
bogdanm | 13:0645d8841f51 | 70 | protected: |
bogdanm | 13:0645d8841f51 | 71 | DigitalOut* _pin[16]; |
bogdanm | 13:0645d8841f51 | 72 | }; |
bogdanm | 13:0645d8841f51 | 73 | |
bogdanm | 13:0645d8841f51 | 74 | } // namespace mbed |
bogdanm | 13:0645d8841f51 | 75 | |
bogdanm | 13:0645d8841f51 | 76 | #endif |