strat des robots

Fork of CRAC-Strat_2017 by CRAC Team

Committer:
ClementBreteau
Date:
Fri May 19 17:14:07 2017 +0000
Revision:
17:d1594579eec6
Parent:
0:ad97421fb1fb
strat du robot, 19-05-2017, 19h

Who changed what in which revision?

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