Upgrade gcc4mbed project used by Smoothie.
[clinton/Smoothieware.git] / gcc4mbed / external / mbed / wait_api.h
CommitLineData
4cff3ded
AW
1/* Title: wait
2 * Generic wait functions.
3 *
4 * These provide simple NOP type wait capabilities.
5 *
6 * Example:
7 * > #include "mbed.h"
8 * >
9 * > DigitalOut heartbeat(LED1);
10 * >
11 * > int main() {
12 * > while (1) {
13 * > heartbeat = 1;
14 * > wait(0.5);
15 * > heartbeat = 0;
16 * > wait(0.5);
17 * > }
18 * > }
19 */
20
21/* mbed Microcontroller Library - wait_api
22 * Copyright (c) 2009 ARM Limited. All rights reserved.
4cff3ded
AW
23 */
24
4cff3ded
AW
25#ifndef MBED_WAIT_API_H
26#define MBED_WAIT_API_H
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32/* Function: wait
33 * Waits for a number of seconds, with microsecond resolution (within
34 * the accuracy of single precision floating point).
35 *
36 * Variables:
37 * s - number of seconds to wait
38 */
39void wait(float s);
40
41/* Function: wait_ms
42 * Waits a number of milliseconds.
43 *
44 * Variables:
45 * ms - the whole number of milliseconds to wait
46 */
47void wait_ms(int ms);
48
49/* Function: wait_us
50 * Waits a number of microseconds.
51 *
52 * Variables:
53 * us - the whole number of microseconds to wait
54 */
55void wait_us(int us);
56
8fcce42e
AG
57#ifdef TARGET_LPC11U24
58/* Function: sleep
59 * Send the microcontroller to sleep
60 *
61 * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
62 * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
63 * dynamic power used by the processor, memory systems and buses. The processor, peripheral and
64 * memory state are maintained, and the peripherals continue to work and can generate interrupts.
65 *
66 * The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
67 *
68 * Note: The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
69 * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
70 * able to access the LocalFileSystem
71 */
72void sleep(void);
73
74/* Function: deepsleep
75 * Send the microcontroller to deep sleep
76 *
77 * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
78 * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
79 * is still maintained.
80 *
81 * The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
82 *
83 * Note: The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
84 * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
85 * able to access the LocalFileSystem
86 */
87void deepsleep(void);
88#endif
89
4cff3ded
AW
90#ifdef __cplusplus
91}
92#endif
93
94#endif