Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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