mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Thu Sep 06 13:40:20 2018 +0100
Revision:
187:0387e8f68319
Parent:
186:707f6e361f3e
Child:
189:f392fc9709a3
mbed-dev library. Release version 163

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 160:d5399cc887bb 1
<> 160:d5399cc887bb 2 /** \addtogroup platform */
<> 160:d5399cc887bb 3 /** @{*/
AnnaBridge 178:79309dc6340a 4 /**
AnnaBridge 178:79309dc6340a 5 * \defgroup platform_wait_api wait_api functions
AnnaBridge 178:79309dc6340a 6 * @{
AnnaBridge 178:79309dc6340a 7 */
AnnaBridge 187:0387e8f68319 8
<> 160:d5399cc887bb 9 /* mbed Microcontroller Library
<> 160:d5399cc887bb 10 * Copyright (c) 2006-2013 ARM Limited
<> 160:d5399cc887bb 11 *
<> 160:d5399cc887bb 12 * Licensed under the Apache License, Version 2.0 (the "License");
<> 160:d5399cc887bb 13 * you may not use this file except in compliance with the License.
<> 160:d5399cc887bb 14 * You may obtain a copy of the License at
<> 160:d5399cc887bb 15 *
<> 160:d5399cc887bb 16 * http://www.apache.org/licenses/LICENSE-2.0
<> 160:d5399cc887bb 17 *
<> 160:d5399cc887bb 18 * Unless required by applicable law or agreed to in writing, software
<> 160:d5399cc887bb 19 * distributed under the License is distributed on an "AS IS" BASIS,
<> 160:d5399cc887bb 20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 160:d5399cc887bb 21 * See the License for the specific language governing permissions and
<> 160:d5399cc887bb 22 * limitations under the License.
<> 160:d5399cc887bb 23 */
<> 160:d5399cc887bb 24 #ifndef MBED_WAIT_API_H
<> 160:d5399cc887bb 25 #define MBED_WAIT_API_H
<> 160:d5399cc887bb 26
<> 160:d5399cc887bb 27 #ifdef __cplusplus
<> 160:d5399cc887bb 28 extern "C" {
<> 160:d5399cc887bb 29 #endif
<> 160:d5399cc887bb 30
<> 160:d5399cc887bb 31 /** Generic wait functions.
<> 160:d5399cc887bb 32 *
<> 160:d5399cc887bb 33 * These provide simple NOP type wait capabilities.
<> 160:d5399cc887bb 34 *
<> 160:d5399cc887bb 35 * Example:
<> 160:d5399cc887bb 36 * @code
<> 160:d5399cc887bb 37 * #include "mbed.h"
<> 160:d5399cc887bb 38 *
<> 160:d5399cc887bb 39 * DigitalOut heartbeat(LED1);
<> 160:d5399cc887bb 40 *
<> 160:d5399cc887bb 41 * int main() {
<> 160:d5399cc887bb 42 * while (1) {
<> 160:d5399cc887bb 43 * heartbeat = 1;
<> 160:d5399cc887bb 44 * wait(0.5);
<> 160:d5399cc887bb 45 * heartbeat = 0;
<> 160:d5399cc887bb 46 * wait(0.5);
<> 160:d5399cc887bb 47 * }
<> 160:d5399cc887bb 48 * }
AnnaBridge 167:e84263d55307 49 * @endcode
<> 160:d5399cc887bb 50 */
<> 160:d5399cc887bb 51
<> 160:d5399cc887bb 52 /** Waits for a number of seconds, with microsecond resolution (within
<> 160:d5399cc887bb 53 * the accuracy of single precision floating point).
<> 160:d5399cc887bb 54 *
<> 160:d5399cc887bb 55 * @param s number of seconds to wait
AnnaBridge 187:0387e8f68319 56 *
Anna Bridge 186:707f6e361f3e 57 * @note
AnnaBridge 187:0387e8f68319 58 * If the RTOS is present, this function always spins to get the exact number of microseconds,
AnnaBridge 187:0387e8f68319 59 * which potentially affects power (such as preventing deep sleep) and multithread performance.
Anna Bridge 186:707f6e361f3e 60 * You can avoid it by using Thread::wait().
<> 160:d5399cc887bb 61 */
<> 160:d5399cc887bb 62 void wait(float s);
<> 160:d5399cc887bb 63
<> 160:d5399cc887bb 64 /** Waits a number of milliseconds.
<> 160:d5399cc887bb 65 *
<> 160:d5399cc887bb 66 * @param ms the whole number of milliseconds to wait
AnnaBridge 187:0387e8f68319 67 *
Anna Bridge 186:707f6e361f3e 68 * @note
AnnaBridge 187:0387e8f68319 69 * If the RTOS is present, this function always spins to get the exact number of microseconds,
AnnaBridge 187:0387e8f68319 70 * which potentially affects power (such as preventing deep sleep) and multithread performance.
Anna Bridge 186:707f6e361f3e 71 * You can avoid it by using Thread::wait().
<> 160:d5399cc887bb 72 */
<> 160:d5399cc887bb 73 void wait_ms(int ms);
<> 160:d5399cc887bb 74
<> 160:d5399cc887bb 75 /** Waits a number of microseconds.
<> 160:d5399cc887bb 76 *
<> 160:d5399cc887bb 77 * @param us the whole number of microseconds to wait
AnnaBridge 187:0387e8f68319 78 *
Anna Bridge 186:707f6e361f3e 79 * @note
AnnaBridge 187:0387e8f68319 80 * If the RTOS is present, this function always spins to get the exact number of microseconds,
Anna Bridge 186:707f6e361f3e 81 * which potentially affects power (such as preventing deep sleep) and multithread performance.
<> 160:d5399cc887bb 82 */
<> 160:d5399cc887bb 83 void wait_us(int us);
<> 160:d5399cc887bb 84
<> 160:d5399cc887bb 85 #ifdef __cplusplus
<> 160:d5399cc887bb 86 }
<> 160:d5399cc887bb 87 #endif
<> 160:d5399cc887bb 88
<> 160:d5399cc887bb 89 #endif
<> 160:d5399cc887bb 90
<> 160:d5399cc887bb 91 /** @}*/
AnnaBridge 178:79309dc6340a 92 /** @}*/