Knight KE / Mbed OS Game_Master
Embed: (wiki syntax)

« Back to documentation index

wait_api functions

wait_api functions
[Platform]

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:
snumber of seconds to wait
Note:
If the RTOS is present, this function always spins to get the exact number of microseconds, which potentially affects power (such as preventing deep sleep) and multithread performance. You can avoid it by using Thread::wait().

Definition at line 20 of file mbed_wait_api_stub.cpp.

void wait_ms ( int  ms )

Waits a number of milliseconds.

Parameters:
msthe whole number of milliseconds to wait
Note:
If the RTOS is present, this function always spins to get the exact number of microseconds, which potentially affects power (such as preventing deep sleep) and multithread performance. You can avoid it by using Thread::wait().

Definition at line 23 of file mbed_wait_api_stub.cpp.

void wait_us ( int  us )

Waits a number of microseconds.

Parameters:
usthe whole number of microseconds to wait
Note:
If the RTOS is present, this function always spins to get the exact number of microseconds, which potentially affects power (such as preventing deep sleep) and multithread performance.

Definition at line 26 of file mbed_wait_api_stub.cpp.