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: C12832 MMA7660 mbed
main.cpp@11:28887549c7d5, 2018-03-28 (annotated)
- Committer:
- suzukimitsuru
- Date:
- Wed Mar 28 13:43:08 2018 +0000
- Revision:
- 11:28887549c7d5
- Parent:
- 10:9ca51c678bec
- Child:
- 12:1d5832974d41
??????????????; ?????????????????????????????????????????
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ksaito | 0:c3bc6981ad28 | 1 | #include "mbed.h" |
| ksaito | 0:c3bc6981ad28 | 2 | #include "C12832.h" |
| ksaito | 0:c3bc6981ad28 | 3 | |
| ksaito | 1:2967eac08981 | 4 | #include "commands.h" |
| ksaito | 0:c3bc6981ad28 | 5 | |
| suzukimitsuru | 10:9ca51c678bec | 6 | extern COMMAND_TRRIGER commandList[]; |
| suzukimitsuru | 10:9ca51c678bec | 7 | extern COMMAND_TRRIGER trrigerNull; |
| ksaito | 0:c3bc6981ad28 | 8 | |
| suzukimitsuru | 11:28887549c7d5 | 9 | BusIn joyStick(p15,p12,p13,p16,p14); |
| ksaito | 0:c3bc6981ad28 | 10 | C12832 lcd(p5, p7, p6, p8, p11); |
| ksaito | 0:c3bc6981ad28 | 11 | |
| ksaito | 0:c3bc6981ad28 | 12 | int main() |
| ksaito | 0:c3bc6981ad28 | 13 | { |
| ksaito | 0:c3bc6981ad28 | 14 | lcd.cls(); |
| ksaito | 0:c3bc6981ad28 | 15 | lcd.locate(0,3); |
| ksaito | 0:c3bc6981ad28 | 16 | lcd.printf("mbed Switches application"); |
| ksaito | 0:c3bc6981ad28 | 17 | |
| suzukimitsuru | 10:9ca51c678bec | 18 | for(int index = 0; commandList[index].trigger != 0x00; index++) { |
| suzukimitsuru | 10:9ca51c678bec | 19 | commandList[index].command->initialize(); |
| ksaito | 1:2967eac08981 | 20 | } |
| ksaito | 5:614e3ac042df | 21 | |
| suzukimitsuru | 10:9ca51c678bec | 22 | COMMAND_TRRIGER *current = &trrigerNull; |
| ksaito | 0:c3bc6981ad28 | 23 | while(true) { |
| INTRA\mitsuru.suzuki |
9:35c816293400 | 24 | COMMAND_TRRIGER *request = NULL; |
| suzukimitsuru | 10:9ca51c678bec | 25 | for(int index = 0; commandList[index].trigger != 0x00; index++) { |
| suzukimitsuru | 11:28887549c7d5 | 26 | if (joyStick == commandList[index].trigger) { |
| suzukimitsuru | 10:9ca51c678bec | 27 | request = &commandList[index]; |
| ksaito | 0:c3bc6981ad28 | 28 | } |
| ksaito | 0:c3bc6981ad28 | 29 | } |
| ksaito | 5:614e3ac042df | 30 | if (request != NULL && request != current) { |
| INTRA\mitsuru.suzuki |
9:35c816293400 | 31 | current->command->finalize(); |
| suzukimitsuru | 10:9ca51c678bec | 32 | current = &trrigerNull; |
| ksaito | 5:614e3ac042df | 33 | } |
| ksaito | 5:614e3ac042df | 34 | if (current->trigger == 0x00) { |
| ksaito | 5:614e3ac042df | 35 | if (request != NULL){ |
| ksaito | 5:614e3ac042df | 36 | current = request; |
| ksaito | 5:614e3ac042df | 37 | lcd.locate(0,15); |
| ksaito | 5:614e3ac042df | 38 | lcd.printf(" "); |
| ksaito | 5:614e3ac042df | 39 | lcd.locate(0,15); |
| INTRA\mitsuru.suzuki |
9:35c816293400 | 40 | lcd.printf(current->command->name); |
| INTRA\mitsuru.suzuki |
9:35c816293400 | 41 | current->command->processInitialize(); |
| ksaito | 5:614e3ac042df | 42 | } |
| ksaito | 5:614e3ac042df | 43 | } else { |
| INTRA\mitsuru.suzuki |
9:35c816293400 | 44 | current->command->processRunning(); |
| INTRA\mitsuru.suzuki |
9:35c816293400 | 45 | if (! current->command->processIsContinue()){ |
| INTRA\mitsuru.suzuki |
9:35c816293400 | 46 | current->command->finalize(); |
| suzukimitsuru | 10:9ca51c678bec | 47 | current = &trrigerNull; |
| ksaito | 5:614e3ac042df | 48 | } |
| ksaito | 0:c3bc6981ad28 | 49 | } |
| ksaito | 0:c3bc6981ad28 | 50 | } |
| ksaito | 0:c3bc6981ad28 | 51 | } |