mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Functions | |
void | wait (float s) |
Generic wait functions. | |
void | wait_ms (int ms) |
Waits a number of milliseconds. | |
void | wait_us (int us) |
Waits a number of microseconds. |
Function Documentation
void wait | ( | float | s ) |
Generic wait functions.
These provide simple NOP type wait capabilities.
Example:
#include "mbed.h" DigitalOut heartbeat(LED1); int main() { while (1) { heartbeat = 1; wait(0.5); heartbeat = 0; wait(0.5); } }
Waits for a number of seconds, with microsecond resolution (within the accuracy of single precision floating point).
- Parameters:
-
s number of seconds to wait
- Note:
- If the RTOS is present, this function spins to get the exact number of microseconds for microsecond precision up to 10 milliseconds. If delay is larger than 10 milliseconds and not in ISR, it is the same as `wait_ms`. We recommend `wait_us` and `wait_ms` over `wait`.
Definition at line 25 of file mbed_wait_api_no_rtos.c.
void wait_ms | ( | int | ms ) |
Waits a number of milliseconds.
- Parameters:
-
ms the whole number of milliseconds to wait
- Note:
- If the RTOS is present, it calls ThisThread::sleep_for(), which is same as CMSIS osDelay(). You can't call this from interrupts, and it doesn't lock hardware sleep.
Definition at line 30 of file mbed_wait_api_no_rtos.c.
void wait_us | ( | int | us ) |
Waits a number of microseconds.
- Parameters:
-
us the whole number of microseconds to wait
- Note:
- This function always spins to get the exact number of microseconds. If RTOS is present, this will affect power (by preventing deep sleep) and multithread performance. Therefore, spinning for millisecond wait is not recommended.
Definition at line 35 of file mbed_wait_api_no_rtos.c.
Generated on Tue Jul 12 2022 20:41:16 by 1.7.2