TTDC / Mbed 2 deprecated switches

Dependencies:   C12832 MMA7660 mbed

Committer:
INTRA\mitsuru.suzuki
Date:
Wed Mar 28 18:59:22 2018 +0900
Revision:
9:35c816293400
Parent:
5:614e3ac042df
Child:
10:9ca51c678bec
trigger????????

Who changed what in which revision?

UserRevisionLine numberNew 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
INTRA\mitsuru.suzuki 9:35c816293400 6 extern COMMAND_TRRIGER *commandList[];
INTRA\mitsuru.suzuki 9:35c816293400 7 extern COMMAND_TRRIGER Command_null;
ksaito 0:c3bc6981ad28 8
ksaito 0:c3bc6981ad28 9 BusIn joy(p15,p12,p13,p16);
ksaito 0:c3bc6981ad28 10 DigitalIn fire(p14);
ksaito 0:c3bc6981ad28 11 C12832 lcd(p5, p7, p6, p8, p11);
ksaito 0:c3bc6981ad28 12
ksaito 0:c3bc6981ad28 13 int main()
ksaito 0:c3bc6981ad28 14 {
ksaito 0:c3bc6981ad28 15 lcd.cls();
ksaito 0:c3bc6981ad28 16 lcd.locate(0,3);
ksaito 0:c3bc6981ad28 17 lcd.printf("mbed Switches application");
ksaito 0:c3bc6981ad28 18
ksaito 5:614e3ac042df 19 for(int index = 0; commandList[index]->trigger != 0x00; index++) {
INTRA\mitsuru.suzuki 9:35c816293400 20 commandList[index]->command->initialize();
ksaito 1:2967eac08981 21 }
ksaito 5:614e3ac042df 22
INTRA\mitsuru.suzuki 9:35c816293400 23 COMMAND_TRRIGER *current = &Command_null;
ksaito 0:c3bc6981ad28 24 while(true) {
INTRA\mitsuru.suzuki 9:35c816293400 25 COMMAND_TRRIGER *request = NULL;
ksaito 1:2967eac08981 26 int trigger = fire ? 0xff : joy;
ksaito 5:614e3ac042df 27 for(int index = 0; commandList[index]->trigger != 0x00; index++) {
ksaito 1:2967eac08981 28 if (trigger == commandList[index]->trigger) {
ksaito 5:614e3ac042df 29 request = commandList[index];
ksaito 0:c3bc6981ad28 30 }
ksaito 0:c3bc6981ad28 31 }
ksaito 5:614e3ac042df 32 if (request != NULL && request != current) {
INTRA\mitsuru.suzuki 9:35c816293400 33 current->command->finalize();
ksaito 5:614e3ac042df 34 current = &Command_null;
ksaito 5:614e3ac042df 35 }
ksaito 5:614e3ac042df 36 if (current->trigger == 0x00) {
ksaito 5:614e3ac042df 37 if (request != NULL){
ksaito 5:614e3ac042df 38 current = request;
ksaito 5:614e3ac042df 39 lcd.locate(0,15);
ksaito 5:614e3ac042df 40 lcd.printf(" ");
ksaito 5:614e3ac042df 41 lcd.locate(0,15);
INTRA\mitsuru.suzuki 9:35c816293400 42 lcd.printf(current->command->name);
INTRA\mitsuru.suzuki 9:35c816293400 43 current->command->processInitialize();
ksaito 5:614e3ac042df 44 }
ksaito 5:614e3ac042df 45 } else {
INTRA\mitsuru.suzuki 9:35c816293400 46 current->command->processRunning();
INTRA\mitsuru.suzuki 9:35c816293400 47 if (! current->command->processIsContinue()){
INTRA\mitsuru.suzuki 9:35c816293400 48 current->command->finalize();
ksaito 5:614e3ac042df 49 current = &Command_null;
ksaito 5:614e3ac042df 50 }
ksaito 0:c3bc6981ad28 51 }
ksaito 0:c3bc6981ad28 52 }
ksaito 0:c3bc6981ad28 53 }