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