Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
libraries/tests/mbed/sleep/main.cpp@1:d96dbedaebdb, 2016-11-04 (annotated)
- Committer:
- nexpaq
- Date:
- Fri Nov 04 20:54:50 2016 +0000
- Revision:
- 1:d96dbedaebdb
- Parent:
- 0:6c56fb4bc5f0
Removed extra directories for other platforms
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| nexpaq | 0:6c56fb4bc5f0 | 1 | #include "test_env.h" |
| nexpaq | 0:6c56fb4bc5f0 | 2 | |
| nexpaq | 0:6c56fb4bc5f0 | 3 | #if !DEVICE_SLEEP |
| nexpaq | 0:6c56fb4bc5f0 | 4 | #error [NOT_SUPPORTED] Sleep is not supported |
| nexpaq | 0:6c56fb4bc5f0 | 5 | #endif |
| nexpaq | 0:6c56fb4bc5f0 | 6 | |
| nexpaq | 0:6c56fb4bc5f0 | 7 | #if defined(TARGET_LPC4088) |
| nexpaq | 0:6c56fb4bc5f0 | 8 | InterruptIn wkp(P2_10); |
| nexpaq | 0:6c56fb4bc5f0 | 9 | #elif defined(TARGET_K22F) |
| nexpaq | 0:6c56fb4bc5f0 | 10 | InterruptIn wkp(D0); |
| nexpaq | 0:6c56fb4bc5f0 | 11 | #elif defined(TARGET_LPC11U68) |
| nexpaq | 0:6c56fb4bc5f0 | 12 | InterruptIn wkp(P0_16); |
| nexpaq | 0:6c56fb4bc5f0 | 13 | #elif defined(TARGET_SAMR21G18A) |
| nexpaq | 0:6c56fb4bc5f0 | 14 | InterruptIn wkp(PA28); |
| nexpaq | 0:6c56fb4bc5f0 | 15 | #elif defined(TARGET_SAMD21J18A) |
| nexpaq | 0:6c56fb4bc5f0 | 16 | InterruptIn wkp(PA15); |
| nexpaq | 0:6c56fb4bc5f0 | 17 | #elif defined(TARGET_SAMD21G18A) |
| nexpaq | 0:6c56fb4bc5f0 | 18 | InterruptIn wkp(PB23); |
| nexpaq | 0:6c56fb4bc5f0 | 19 | #elif defined(TARGET_SAML21J18A) |
| nexpaq | 0:6c56fb4bc5f0 | 20 | InterruptIn wkp(PA02); |
| nexpaq | 0:6c56fb4bc5f0 | 21 | #else |
| nexpaq | 0:6c56fb4bc5f0 | 22 | InterruptIn wkp(p14); |
| nexpaq | 0:6c56fb4bc5f0 | 23 | #endif |
| nexpaq | 0:6c56fb4bc5f0 | 24 | |
| nexpaq | 0:6c56fb4bc5f0 | 25 | void flip() { |
| nexpaq | 0:6c56fb4bc5f0 | 26 | printf("button pressed\n"); |
| nexpaq | 0:6c56fb4bc5f0 | 27 | } |
| nexpaq | 0:6c56fb4bc5f0 | 28 | |
| nexpaq | 0:6c56fb4bc5f0 | 29 | int main() { |
| nexpaq | 0:6c56fb4bc5f0 | 30 | #if defined(TARGET_LPC11U68) |
| nexpaq | 0:6c56fb4bc5f0 | 31 | wkp.mode(PullUp); |
| nexpaq | 0:6c56fb4bc5f0 | 32 | #endif |
| nexpaq | 0:6c56fb4bc5f0 | 33 | wkp.rise(&flip); |
| nexpaq | 0:6c56fb4bc5f0 | 34 | |
| nexpaq | 0:6c56fb4bc5f0 | 35 | while (true) { |
| nexpaq | 0:6c56fb4bc5f0 | 36 | // sleep(); |
| nexpaq | 0:6c56fb4bc5f0 | 37 | deepsleep(); |
| nexpaq | 0:6c56fb4bc5f0 | 38 | } |
| nexpaq | 0:6c56fb4bc5f0 | 39 | } |