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