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