The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
platform/mbed_wait_api.h@169:a7c7b631e539, 2018-06-22 (annotated)
- Committer:
- Anna Bridge
- Date:
- Fri Jun 22 15:38:59 2018 +0100
- Revision:
- 169:a7c7b631e539
- Parent:
- 168:b9e159c1930a
- Child:
- 170:e95d10626187
mbed library. Release version 162
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 156:ff21514d8981 | 1 | |
AnnaBridge | 156:ff21514d8981 | 2 | /** \addtogroup platform */ |
AnnaBridge | 156:ff21514d8981 | 3 | /** @{*/ |
AnnaBridge | 158:1c57384330a6 | 4 | /** |
AnnaBridge | 158:1c57384330a6 | 5 | * \defgroup platform_wait_api wait_api functions |
AnnaBridge | 158:1c57384330a6 | 6 | * @{ |
AnnaBridge | 158:1c57384330a6 | 7 | */ |
AnnaBridge | 158:1c57384330a6 | 8 | |
AnnaBridge | 156:ff21514d8981 | 9 | /* mbed Microcontroller Library |
AnnaBridge | 156:ff21514d8981 | 10 | * Copyright (c) 2006-2013 ARM Limited |
AnnaBridge | 156:ff21514d8981 | 11 | * |
AnnaBridge | 156:ff21514d8981 | 12 | * Licensed under the Apache License, Version 2.0 (the "License"); |
AnnaBridge | 156:ff21514d8981 | 13 | * you may not use this file except in compliance with the License. |
AnnaBridge | 156:ff21514d8981 | 14 | * You may obtain a copy of the License at |
AnnaBridge | 156:ff21514d8981 | 15 | * |
AnnaBridge | 156:ff21514d8981 | 16 | * http://www.apache.org/licenses/LICENSE-2.0 |
AnnaBridge | 156:ff21514d8981 | 17 | * |
AnnaBridge | 156:ff21514d8981 | 18 | * Unless required by applicable law or agreed to in writing, software |
AnnaBridge | 156:ff21514d8981 | 19 | * distributed under the License is distributed on an "AS IS" BASIS, |
AnnaBridge | 156:ff21514d8981 | 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
AnnaBridge | 156:ff21514d8981 | 21 | * See the License for the specific language governing permissions and |
AnnaBridge | 156:ff21514d8981 | 22 | * limitations under the License. |
AnnaBridge | 156:ff21514d8981 | 23 | */ |
AnnaBridge | 156:ff21514d8981 | 24 | #ifndef MBED_WAIT_API_H |
AnnaBridge | 156:ff21514d8981 | 25 | #define MBED_WAIT_API_H |
AnnaBridge | 156:ff21514d8981 | 26 | |
AnnaBridge | 156:ff21514d8981 | 27 | #ifdef __cplusplus |
AnnaBridge | 156:ff21514d8981 | 28 | extern "C" { |
AnnaBridge | 156:ff21514d8981 | 29 | #endif |
AnnaBridge | 156:ff21514d8981 | 30 | |
AnnaBridge | 156:ff21514d8981 | 31 | /** Generic wait functions. |
AnnaBridge | 156:ff21514d8981 | 32 | * |
AnnaBridge | 156:ff21514d8981 | 33 | * These provide simple NOP type wait capabilities. |
AnnaBridge | 156:ff21514d8981 | 34 | * |
AnnaBridge | 156:ff21514d8981 | 35 | * Example: |
AnnaBridge | 156:ff21514d8981 | 36 | * @code |
AnnaBridge | 156:ff21514d8981 | 37 | * #include "mbed.h" |
AnnaBridge | 156:ff21514d8981 | 38 | * |
AnnaBridge | 156:ff21514d8981 | 39 | * DigitalOut heartbeat(LED1); |
AnnaBridge | 156:ff21514d8981 | 40 | * |
AnnaBridge | 156:ff21514d8981 | 41 | * int main() { |
AnnaBridge | 156:ff21514d8981 | 42 | * while (1) { |
AnnaBridge | 156:ff21514d8981 | 43 | * heartbeat = 1; |
AnnaBridge | 156:ff21514d8981 | 44 | * wait(0.5); |
AnnaBridge | 156:ff21514d8981 | 45 | * heartbeat = 0; |
AnnaBridge | 156:ff21514d8981 | 46 | * wait(0.5); |
AnnaBridge | 156:ff21514d8981 | 47 | * } |
AnnaBridge | 156:ff21514d8981 | 48 | * } |
AnnaBridge | 156:ff21514d8981 | 49 | * @endcode |
AnnaBridge | 156:ff21514d8981 | 50 | */ |
AnnaBridge | 156:ff21514d8981 | 51 | |
AnnaBridge | 156:ff21514d8981 | 52 | /** Waits for a number of seconds, with microsecond resolution (within |
AnnaBridge | 156:ff21514d8981 | 53 | * the accuracy of single precision floating point). |
AnnaBridge | 156:ff21514d8981 | 54 | * |
AnnaBridge | 156:ff21514d8981 | 55 | * @param s number of seconds to wait |
AnnaBridge | 168:b9e159c1930a | 56 | * |
AnnaBridge | 168:b9e159c1930a | 57 | * @note |
AnnaBridge | 168:b9e159c1930a | 58 | * If the RTOS is present, this function always spins to get the exact number of microseconds, |
AnnaBridge | 168:b9e159c1930a | 59 | * which potentially affects power (such as preventing deep sleep) and multithread performance. |
AnnaBridge | 168:b9e159c1930a | 60 | * You can avoid it by using Thread::wait(). |
AnnaBridge | 156:ff21514d8981 | 61 | */ |
AnnaBridge | 156:ff21514d8981 | 62 | void wait(float s); |
AnnaBridge | 156:ff21514d8981 | 63 | |
AnnaBridge | 156:ff21514d8981 | 64 | /** Waits a number of milliseconds. |
AnnaBridge | 156:ff21514d8981 | 65 | * |
AnnaBridge | 156:ff21514d8981 | 66 | * @param ms the whole number of milliseconds to wait |
AnnaBridge | 168:b9e159c1930a | 67 | * |
AnnaBridge | 168:b9e159c1930a | 68 | * @note |
AnnaBridge | 168:b9e159c1930a | 69 | * If the RTOS is present, this function always spins to get the exact number of microseconds, |
AnnaBridge | 168:b9e159c1930a | 70 | * which potentially affects power (such as preventing deep sleep) and multithread performance. |
AnnaBridge | 168:b9e159c1930a | 71 | * You can avoid it by using Thread::wait(). |
AnnaBridge | 156:ff21514d8981 | 72 | */ |
AnnaBridge | 156:ff21514d8981 | 73 | void wait_ms(int ms); |
AnnaBridge | 156:ff21514d8981 | 74 | |
AnnaBridge | 156:ff21514d8981 | 75 | /** Waits a number of microseconds. |
AnnaBridge | 156:ff21514d8981 | 76 | * |
AnnaBridge | 156:ff21514d8981 | 77 | * @param us the whole number of microseconds to wait |
AnnaBridge | 168:b9e159c1930a | 78 | * |
AnnaBridge | 168:b9e159c1930a | 79 | * @note |
AnnaBridge | 168:b9e159c1930a | 80 | * If the RTOS is present, this function always spins to get the exact number of microseconds, |
AnnaBridge | 168:b9e159c1930a | 81 | * which potentially affects power (such as preventing deep sleep) and multithread performance. |
AnnaBridge | 156:ff21514d8981 | 82 | */ |
AnnaBridge | 156:ff21514d8981 | 83 | void wait_us(int us); |
AnnaBridge | 156:ff21514d8981 | 84 | |
AnnaBridge | 156:ff21514d8981 | 85 | #ifdef __cplusplus |
AnnaBridge | 156:ff21514d8981 | 86 | } |
AnnaBridge | 156:ff21514d8981 | 87 | #endif |
AnnaBridge | 156:ff21514d8981 | 88 | |
AnnaBridge | 156:ff21514d8981 | 89 | #endif |
AnnaBridge | 156:ff21514d8981 | 90 | |
AnnaBridge | 156:ff21514d8981 | 91 | /** @}*/ |
AnnaBridge | 158:1c57384330a6 | 92 | /** @}*/ |