TTDC / Mbed 2 deprecated switches

Dependencies:   C12832 MMA7660 mbed

Revision:
9:35c816293400
Parent:
5:614e3ac042df
Child:
10:9ca51c678bec
--- a/main.cpp	Wed Mar 28 18:35:53 2018 +0900
+++ b/main.cpp	Wed Mar 28 18:59:22 2018 +0900
@@ -3,8 +3,8 @@
 
 #include "commands.h"
 
-extern COMMAND_DEFINE   *commandList[];
-extern COMMAND_DEFINE   Command_null;
+extern COMMAND_TRRIGER   *commandList[];
+extern COMMAND_TRRIGER   Command_null;
 
 BusIn joy(p15,p12,p13,p16);
 DigitalIn fire(p14);
@@ -17,12 +17,12 @@
     lcd.printf("mbed Switches application");
     
     for(int index = 0; commandList[index]->trigger != 0x00; index++) {
-        commandList[index]->initialize();
+        commandList[index]->command->initialize();
     }
     
-    COMMAND_DEFINE *current = &Command_null;
+    COMMAND_TRRIGER *current = &Command_null;
     while(true) {
-        COMMAND_DEFINE *request = NULL;
+        COMMAND_TRRIGER *request = NULL;
         int trigger = fire ? 0xff : joy;
         for(int index = 0; commandList[index]->trigger != 0x00; index++) {
             if (trigger == commandList[index]->trigger) {
@@ -30,7 +30,7 @@
             }
         }
         if (request != NULL && request != current) {
-            current->finalize();
+            current->command->finalize();
             current = &Command_null;
         }
         if (current->trigger == 0x00) {
@@ -39,13 +39,13 @@
                 lcd.locate(0,15);
                 lcd.printf("        ");
                 lcd.locate(0,15);
-                lcd.printf(current->name);
-                current->processInitialize();
+                lcd.printf(current->command->name);
+                current->command->processInitialize();
             }
         } else {
-            current->processRunning();
-            if (! current->processIsContinue()){
-                current->finalize();
+            current->command->processRunning();
+            if (! current->command->processIsContinue()){
+                current->command->finalize();
                 current = &Command_null;
             }
         }