mbed libraries for KL25Z

Dependents:   FRDM_RGBLED

Committer:
emilmont
Date:
Fri Oct 05 09:16:41 2012 +0000
Revision:
0:8024c367e29f
Child:
8:c14af7958ef5
First release of the mbed libraries for KL25Z

Who changed what in which revision?

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