eLab Team / Mbed 2 deprecated LaLaBox

Dependencies:   mbed CREALIB

Revision:
2:050f12806bc5
Parent:
1:ab4c9a0a5374
Child:
3:50e030d90648
diff -r ab4c9a0a5374 -r 050f12806bc5 main.cpp
--- a/main.cpp	Fri Jun 17 10:48:18 2016 +0000
+++ b/main.cpp	Fri Jun 17 11:18:41 2016 +0000
@@ -1,35 +1,6 @@
 #include "LaLaBox.h"
 
 // ---------------- Local global variables --------------
-DigitalOut myled(LED1);     // Blinking LED
-// -------------------- Motor ---------------------------
-Ticker  MotorSystemTick;    // System Callback for Motor
-timestamp_t MotorStepTime;  // Time in µs for one motor step
-uint32_t    MotorFullTurn;  // Number of step for a complete turn
-uint32_t    NumWires;       // Number of Wires
-uint32_t    NumSteps;       // Number of Steps = NumWire * MotorFullTurn
-
-enum MotorStateList {   // Define Motor States for the State Machine
-    Motor_IDLE = 0,
-    Motor_RUN,
-    Motor_PAUSE,
-    Motor_ZERO,
-    Motor_CALIB
-    } MotorState = Motor_IDLE;
-
-enum MotorCommandList { // Define Motor State Machine Commands
-    k_nop = 0,
-    k_wire,
-    k_pause,
-    k_restart,
-    k_stop,
-    k_zero
-    } MotorCommand;
-    
-enum MotorDirectionList { // Define Motor Clockwise or Anticlockwise
-    d_clock = 0,
-    d_anti
-    } MotorDir;
     
 // --- Sound ---
 char *song_happy_birthday = "Happy Birthday Song:d=4,o=5,b=125:16c,32p,32c,32p,8d,32p,8c,32p,8f,32p,e,16p,16c,32p,32c,32p,8d,32p,8c,32p,8g,32p,f,8p,16c,32p,32c,32p,8c6,32p,8a,32p,8f,32p,8e,32p,8d,32p,16a#,32p,32a#,32p,8a,32p,8f,32p,8g,32p,f";
@@ -38,25 +9,20 @@
 char *song_xfile = "Xfiles:d=4,o=5,b=140:e,b,a,b,d6,2b.";
 char *song_christmas ="Christmas:d=4,o=5,b=100:f#,g#,2a#,2a#,d#.,8f,f,f,2f#,2d#,2f#.6,f#,#g,8g#,g#,8a#,b,8c#,c#,2c#,8d#,8f.,8f#.,8f.,d#,f,2f#.,a#,8b.,8b.,8b.,d#,f,2c#.,a#,8b.,8b.,8b.,d#,f,f#,p,g#,g#,g#,8g#,8a#,8g#,f#.,g#,a#,p,c,c,c,8c,8c#,8c,a#.,c,c#,a#,b,a#,a,a#,b,c,";
 
+// ---------------- PIN DEFINITIONS ---------------------
+DigitalOut myled(LED1);     // Blinking LED
+
+// --- Define the Foor PINs used for Motor drive -----
+Motor(PA_9, PC_7, PB_6, PA_7)
+
 // --- Define PC_8 as the output of PWM use for Tones -----
 Buzzer buzzer(PC_8);
 
 Music* pMusic=0;    //the song
 Note la("A#4",50);  //the sound
 
-// --- Define the Foor PINs used for Motor drive -----
-DigitalOut MPh3(PA_7);
-DigitalOut MPh2(PB_6);
-DigitalOut MPh1(PC_7);
-DigitalOut MPh0(PA_9);
-// --- Motor Variable
-int MotorIndex = 0;
 // --- Motor Routine
-void    StopMotor() // --- Stop Motor
-{
-        MPh0 = 0;  MPh1 = 0;  MPh2 = 0;  MPh3 = 0;
-        MotorIndex = 0;
-}
+
 void    StartMotor()
 {
         MotorIndex = 0;