Strategie_13h30

Fork of CRAC-Strat_2017_homologation_gros_rob by CRAC Team

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers wait_api.h Source File

wait_api.h

00001 /* Title: wait
00002  * Generic wait functions.
00003  *
00004  * These provide simple NOP type wait capabilities.
00005  *
00006  * Example:
00007  * > #include "mbed.h"
00008  * >
00009  * > DigitalOut heartbeat(LED1);
00010  * >
00011  * > int main() {
00012  * >     while (1) {
00013  * >         heartbeat = 1;
00014  * >         wait(0.5);
00015  * >         heartbeat = 0;
00016  * >         wait(0.5);
00017  * >     }
00018  * > }
00019  */
00020 
00021 /* mbed Microcontroller Library - wait_api
00022  * Copyright (c) 2009 ARM Limited. All rights reserved.
00023  */ 
00024  
00025 #ifndef MBED_WAIT_API_H
00026 #define MBED_WAIT_API_H
00027 
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031 
00032 /* Function: wait
00033  *  Waits for a number of seconds, with microsecond resolution (within
00034  *  the accuracy of single precision floating point).
00035  *
00036  * Variables:
00037  *  s - number of seconds to wait
00038  */
00039 void wait(float s);
00040 
00041 /* Function: wait_ms
00042  *  Waits a number of milliseconds.
00043  *
00044  * Variables:
00045  *  ms - the whole number of milliseconds to wait
00046  */
00047 void wait_ms(int ms);
00048 
00049 /* Function: wait_us
00050  *  Waits a number of microseconds.
00051  *
00052  * Variables:
00053  *  us - the whole number of microseconds to wait
00054  */
00055 void wait_us(int us);
00056 
00057 #ifdef TARGET_LPC11U24
00058 /* Function: sleep
00059  *  Send the microcontroller to sleep
00060  * 
00061  * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
00062  * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates 
00063  * dynamic power used by the processor, memory systems and buses. The processor, peripheral and 
00064  * memory state are maintained, and the peripherals continue to work and can generate interrupts.
00065  * 
00066  * The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
00067  * 
00068  * Note: The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. 
00069  * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
00070  * able to access the LocalFileSystem
00071  */
00072 void sleep(void);
00073 
00074 /* Function: deepsleep
00075  *  Send the microcontroller to deep sleep
00076  * 
00077  * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
00078  * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
00079  * is still maintained. 
00080  * 
00081  * The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
00082  * 
00083  * Note: The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. 
00084  * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
00085  * able to access the LocalFileSystem
00086  */
00087 void deepsleep(void);
00088 #endif
00089 
00090 #ifdef __cplusplus
00091 }
00092 #endif
00093 
00094 #endif