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.
Dependencies: SDFileSystem mbed
Fork of PES4_Programme by
source/main.cpp@34:9d6dd3a12641, 2018-03-27 (annotated)
- Committer:
- aeschsim
- Date:
- Tue Mar 27 10:56:49 2018 +0000
- Revision:
- 34:9d6dd3a12641
- Parent:
- 27:bf0577ecfa6e
- Child:
- 35:a9bf045dc014
testtool readtime (state 46)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cittecla | 3:94026b29e994 | 1 | #include "main.h" |
cittecla | 2:72886e996098 | 2 | |
itslinear | 17:bbafd216e059 | 3 | |
aeschsim | 34:9d6dd3a12641 | 4 | int state = 46; |
aeschsim | 34:9d6dd3a12641 | 5 | int old_state; |
cittecla | 2:72886e996098 | 6 | |
cittecla | 2:72886e996098 | 7 | Serial pc(USBTX, USBRX); // tx, rx |
aeschsim | 27:bf0577ecfa6e | 8 | char buf[100]; |
cittecla | 2:72886e996098 | 9 | |
cittecla | 2:72886e996098 | 10 | int main() |
cittecla | 2:72886e996098 | 11 | { |
cittecla | 2:72886e996098 | 12 | pc.baud(460800); |
cittecla | 2:72886e996098 | 13 | printf("start...\r\n"); |
cittecla | 2:72886e996098 | 14 | |
aeschsim | 34:9d6dd3a12641 | 15 | while(1) { |
aeschsim | 34:9d6dd3a12641 | 16 | if(state != old_state) { |
aeschsim | 34:9d6dd3a12641 | 17 | printf("state: %d\r\n",state); |
aeschsim | 34:9d6dd3a12641 | 18 | old_state = state; |
aeschsim | 34:9d6dd3a12641 | 19 | } |
aeschsim | 34:9d6dd3a12641 | 20 | switch (state) { |
aeschsim | 34:9d6dd3a12641 | 21 | case 0: |
aeschsim | 34:9d6dd3a12641 | 22 | printf("Hello World"); |
aeschsim | 34:9d6dd3a12641 | 23 | state = 1; |
aeschsim | 34:9d6dd3a12641 | 24 | break; |
aeschsim | 34:9d6dd3a12641 | 25 | case 1: |
aeschsim | 34:9d6dd3a12641 | 26 | break; |
aeschsim | 34:9d6dd3a12641 | 27 | case 2: |
aeschsim | 34:9d6dd3a12641 | 28 | break; |
aeschsim | 34:9d6dd3a12641 | 29 | case 3: |
aeschsim | 34:9d6dd3a12641 | 30 | break; |
cittecla | 2:72886e996098 | 31 | |
aeschsim | 34:9d6dd3a12641 | 32 | case 10: |
aeschsim | 34:9d6dd3a12641 | 33 | break; |
aeschsim | 34:9d6dd3a12641 | 34 | case 11: |
aeschsim | 34:9d6dd3a12641 | 35 | break; |
cittecla | 2:72886e996098 | 36 | |
aeschsim | 34:9d6dd3a12641 | 37 | case 15: |
aeschsim | 34:9d6dd3a12641 | 38 | break; |
aeschsim | 34:9d6dd3a12641 | 39 | case 16: |
aeschsim | 34:9d6dd3a12641 | 40 | break; |
aeschsim | 34:9d6dd3a12641 | 41 | case 17: |
aeschsim | 34:9d6dd3a12641 | 42 | break; |
aeschsim | 34:9d6dd3a12641 | 43 | |
aeschsim | 34:9d6dd3a12641 | 44 | case 25: |
aeschsim | 34:9d6dd3a12641 | 45 | break; |
aeschsim | 34:9d6dd3a12641 | 46 | case 26: |
aeschsim | 34:9d6dd3a12641 | 47 | break; |
aeschsim | 34:9d6dd3a12641 | 48 | case 27: |
aeschsim | 34:9d6dd3a12641 | 49 | break; |
aeschsim | 34:9d6dd3a12641 | 50 | case 28: |
aeschsim | 34:9d6dd3a12641 | 51 | break; |
cittecla | 2:72886e996098 | 52 | |
cittecla | 2:72886e996098 | 53 | |
aeschsim | 34:9d6dd3a12641 | 54 | case 35: |
aeschsim | 34:9d6dd3a12641 | 55 | break; |
aeschsim | 34:9d6dd3a12641 | 56 | case 36: |
aeschsim | 34:9d6dd3a12641 | 57 | break; |
aeschsim | 34:9d6dd3a12641 | 58 | case 37: |
aeschsim | 34:9d6dd3a12641 | 59 | break; |
aeschsim | 34:9d6dd3a12641 | 60 | case 38: |
aeschsim | 34:9d6dd3a12641 | 61 | break; |
aeschsim | 27:bf0577ecfa6e | 62 | |
aeschsim | 34:9d6dd3a12641 | 63 | /* Time test tool */ |
aeschsim | 34:9d6dd3a12641 | 64 | case 45: |
aeschsim | 34:9d6dd3a12641 | 65 | s_time time; |
aeschsim | 34:9d6dd3a12641 | 66 | time.second = 30; |
aeschsim | 34:9d6dd3a12641 | 67 | time.minute = 53; |
aeschsim | 34:9d6dd3a12641 | 68 | time.hour = 12; |
aeschsim | 34:9d6dd3a12641 | 69 | time.day = 27; |
aeschsim | 34:9d6dd3a12641 | 70 | time.weekday = 2; |
aeschsim | 34:9d6dd3a12641 | 71 | time.month = 3; |
aeschsim | 34:9d6dd3a12641 | 72 | time.year = 18; |
aeschsim | 34:9d6dd3a12641 | 73 | pc.printf("set now time\r\n"); |
aeschsim | 34:9d6dd3a12641 | 74 | setTime(&time); |
aeschsim | 34:9d6dd3a12641 | 75 | pc.printf("read time: %d:%d:%d, %d.%d.20%d, weekday: %d\r\n",time.hour, time.minute, time.second, time.day, time.month, time.year, time.weekday); |
aeschsim | 34:9d6dd3a12641 | 76 | state = 46; |
aeschsim | 34:9d6dd3a12641 | 77 | pc.printf("change state to: %d\r\n",state); |
aeschsim | 34:9d6dd3a12641 | 78 | break; |
aeschsim | 34:9d6dd3a12641 | 79 | case 46: |
aeschsim | 34:9d6dd3a12641 | 80 | wait(5); |
aeschsim | 34:9d6dd3a12641 | 81 | time = getTime(); |
aeschsim | 34:9d6dd3a12641 | 82 | pc.printf("read time: %2d:%2d:%2d, %2d.%2d.20%2d, weekday: %d\r\n",time.hour, time.minute, time.second, time.day, time.month, time.year, time.weekday); |
aeschsim | 34:9d6dd3a12641 | 83 | state = 46; |
aeschsim | 34:9d6dd3a12641 | 84 | break; |
aeschsim | 34:9d6dd3a12641 | 85 | case 48: |
aeschsim | 34:9d6dd3a12641 | 86 | break; |
cittecla | 2:72886e996098 | 87 | |
cittecla | 2:72886e996098 | 88 | |
aeschsim | 34:9d6dd3a12641 | 89 | case 50: |
aeschsim | 34:9d6dd3a12641 | 90 | break; |
aeschsim | 34:9d6dd3a12641 | 91 | } |
cittecla | 2:72886e996098 | 92 | } |
aeschsim | 34:9d6dd3a12641 | 93 | pc.printf("exit while 1 loop"); |
cittecla | 2:72886e996098 | 94 | } |