Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mbed_wait_api.h
00001 00002 /** \addtogroup platform */ 00003 /** @{*/ 00004 /** 00005 * \defgroup platform_wait_api wait_api functions 00006 * @{ 00007 */ 00008 00009 /* mbed Microcontroller Library 00010 * Copyright (c) 2006-2013 ARM Limited 00011 * 00012 * Licensed under the Apache License, Version 2.0 (the "License"); 00013 * you may not use this file except in compliance with the License. 00014 * You may obtain a copy of the License at 00015 * 00016 * http://www.apache.org/licenses/LICENSE-2.0 00017 * 00018 * Unless required by applicable law or agreed to in writing, software 00019 * distributed under the License is distributed on an "AS IS" BASIS, 00020 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00021 * See the License for the specific language governing permissions and 00022 * limitations under the License. 00023 */ 00024 #ifndef MBED_WAIT_API_H 00025 #define MBED_WAIT_API_H 00026 00027 #ifdef __cplusplus 00028 extern "C" { 00029 #endif 00030 00031 /** Generic wait functions. 00032 * 00033 * These provide simple NOP type wait capabilities. 00034 * 00035 * Example: 00036 * @code 00037 * #include "mbed.h" 00038 * 00039 * DigitalOut heartbeat(LED1); 00040 * 00041 * int main() { 00042 * while (1) { 00043 * heartbeat = 1; 00044 * wait(0.5); 00045 * heartbeat = 0; 00046 * wait(0.5); 00047 * } 00048 * } 00049 * @endcode 00050 */ 00051 00052 /** Waits for a number of seconds, with microsecond resolution (within 00053 * the accuracy of single precision floating point). 00054 * 00055 * @param s number of seconds to wait 00056 * 00057 * @note 00058 * If the RTOS is present, this function always spins to get the exact number of microseconds, 00059 * which potentially affects power (such as preventing deep sleep) and multithread performance. 00060 * You can avoid it by using Thread::wait(). 00061 */ 00062 void wait(float s); 00063 00064 /** Waits a number of milliseconds. 00065 * 00066 * @param ms the whole number of milliseconds to wait 00067 * 00068 * @note 00069 * If the RTOS is present, this function always spins to get the exact number of microseconds, 00070 * which potentially affects power (such as preventing deep sleep) and multithread performance. 00071 * You can avoid it by using Thread::wait(). 00072 */ 00073 void wait_ms(int ms); 00074 00075 /** Waits a number of microseconds. 00076 * 00077 * @param us the whole number of microseconds to wait 00078 * 00079 * @note 00080 * If the RTOS is present, this function always spins to get the exact number of microseconds, 00081 * which potentially affects power (such as preventing deep sleep) and multithread performance. 00082 */ 00083 void wait_us(int us); 00084 00085 #ifdef __cplusplus 00086 } 00087 #endif 00088 00089 #endif 00090 00091 /** @}*/ 00092 /** @}*/
Generated on Tue Jul 12 2022 18:18:43 by
