mbed library sources. Supersedes mbed-src.
Fork of mbed-dev by
platform/mbed_wait_api.h@165:2dd56e6daeec, 2017-05-23 (annotated)
- Committer:
- ranaumarnaeem
- Date:
- Tue May 23 12:54:50 2017 +0000
- Revision:
- 165:2dd56e6daeec
- Parent:
- 160:d5399cc887bb
jhjg
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 160:d5399cc887bb | 1 | |
<> | 160:d5399cc887bb | 2 | /** \addtogroup platform */ |
<> | 160:d5399cc887bb | 3 | /** @{*/ |
<> | 160:d5399cc887bb | 4 | /* mbed Microcontroller Library |
<> | 160:d5399cc887bb | 5 | * Copyright (c) 2006-2013 ARM Limited |
<> | 160:d5399cc887bb | 6 | * |
<> | 160:d5399cc887bb | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
<> | 160:d5399cc887bb | 8 | * you may not use this file except in compliance with the License. |
<> | 160:d5399cc887bb | 9 | * You may obtain a copy of the License at |
<> | 160:d5399cc887bb | 10 | * |
<> | 160:d5399cc887bb | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 160:d5399cc887bb | 12 | * |
<> | 160:d5399cc887bb | 13 | * Unless required by applicable law or agreed to in writing, software |
<> | 160:d5399cc887bb | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
<> | 160:d5399cc887bb | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 160:d5399cc887bb | 16 | * See the License for the specific language governing permissions and |
<> | 160:d5399cc887bb | 17 | * limitations under the License. |
<> | 160:d5399cc887bb | 18 | */ |
<> | 160:d5399cc887bb | 19 | #ifndef MBED_WAIT_API_H |
<> | 160:d5399cc887bb | 20 | #define MBED_WAIT_API_H |
<> | 160:d5399cc887bb | 21 | |
<> | 160:d5399cc887bb | 22 | #ifdef __cplusplus |
<> | 160:d5399cc887bb | 23 | extern "C" { |
<> | 160:d5399cc887bb | 24 | #endif |
<> | 160:d5399cc887bb | 25 | |
<> | 160:d5399cc887bb | 26 | /** Generic wait functions. |
<> | 160:d5399cc887bb | 27 | * |
<> | 160:d5399cc887bb | 28 | * These provide simple NOP type wait capabilities. |
<> | 160:d5399cc887bb | 29 | * |
<> | 160:d5399cc887bb | 30 | * Example: |
<> | 160:d5399cc887bb | 31 | * @code |
<> | 160:d5399cc887bb | 32 | * #include "mbed.h" |
<> | 160:d5399cc887bb | 33 | * |
<> | 160:d5399cc887bb | 34 | * DigitalOut heartbeat(LED1); |
<> | 160:d5399cc887bb | 35 | * |
<> | 160:d5399cc887bb | 36 | * int main() { |
<> | 160:d5399cc887bb | 37 | * while (1) { |
<> | 160:d5399cc887bb | 38 | * heartbeat = 1; |
<> | 160:d5399cc887bb | 39 | * wait(0.5); |
<> | 160:d5399cc887bb | 40 | * heartbeat = 0; |
<> | 160:d5399cc887bb | 41 | * wait(0.5); |
<> | 160:d5399cc887bb | 42 | * } |
<> | 160:d5399cc887bb | 43 | * } |
<> | 160:d5399cc887bb | 44 | */ |
<> | 160:d5399cc887bb | 45 | |
<> | 160:d5399cc887bb | 46 | /** Waits for a number of seconds, with microsecond resolution (within |
<> | 160:d5399cc887bb | 47 | * the accuracy of single precision floating point). |
<> | 160:d5399cc887bb | 48 | * |
<> | 160:d5399cc887bb | 49 | * @param s number of seconds to wait |
<> | 160:d5399cc887bb | 50 | */ |
<> | 160:d5399cc887bb | 51 | void wait(float s); |
<> | 160:d5399cc887bb | 52 | |
<> | 160:d5399cc887bb | 53 | /** Waits a number of milliseconds. |
<> | 160:d5399cc887bb | 54 | * |
<> | 160:d5399cc887bb | 55 | * @param ms the whole number of milliseconds to wait |
<> | 160:d5399cc887bb | 56 | */ |
<> | 160:d5399cc887bb | 57 | void wait_ms(int ms); |
<> | 160:d5399cc887bb | 58 | |
<> | 160:d5399cc887bb | 59 | /** Waits a number of microseconds. |
<> | 160:d5399cc887bb | 60 | * |
<> | 160:d5399cc887bb | 61 | * @param us the whole number of microseconds to wait |
<> | 160:d5399cc887bb | 62 | */ |
<> | 160:d5399cc887bb | 63 | void wait_us(int us); |
<> | 160:d5399cc887bb | 64 | |
<> | 160:d5399cc887bb | 65 | #ifdef __cplusplus |
<> | 160:d5399cc887bb | 66 | } |
<> | 160:d5399cc887bb | 67 | #endif |
<> | 160:d5399cc887bb | 68 | |
<> | 160:d5399cc887bb | 69 | #endif |
<> | 160:d5399cc887bb | 70 | |
<> | 160:d5399cc887bb | 71 | /** @}*/ |