...

Dependents:   2doejemplo Labo_TRSE_Drone

Fork of mbed by mbed official

Committer:
emilmont
Date:
Fri Oct 26 17:40:46 2012 +0100
Revision:
43:e2ed12d17f06
Parent:
27:7110ebee3484
Child:
44:24d45a770a51
Update documentation

Who changed what in which revision?

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