ES2017 coursework 2

Dependencies:   PID

Fork of ES_CW2_Starter by Edward Stott

Revision:
16:372c720015ab
Parent:
15:d9e50101a17e
Child:
17:9cd9f82027ca
diff -r d9e50101a17e -r 372c720015ab main.cpp
--- a/main.cpp	Thu Mar 09 14:56:06 2017 +0000
+++ b/main.cpp	Thu Mar 09 15:00:44 2017 +0000
@@ -45,23 +45,11 @@
 7       -   -   -
 */
 //Drive state to output table
-//const int8_t driveTable[] = {0x12,0x18,0x09,0x21,0x24,0x06,0x00,0x00};
 const int8_t driveTable[6] = {0x38, 0x2C, 0x0E, 0x0B, 0x23, 0x32};
 
-//const int8_t cwState[7] = {0, 4, 0, 5, 2, 3, 1};
-//const int8_t AcwState[7] = {0, 2, 4, 3, 0, 1, 5};
-//const int8_t cwState[7] = {0x00, 0x23, 0x38, 0x32, 0x0E, 0x0B, 0x2C};
-//const int8_t AcwState[7] = {0x00, 0x0E, 0x23, 0x0B, 0x38, 0x2C, 0x32};
 const int8_t AcwState[7] = {0x00, 0x23, 0x38, 0x32, 0x0E, 0x0B, 0x2C};
 const int8_t cwState[7] = {0x00, 0x0E, 0x23, 0x0B, 0x38, 0x2C, 0x32};
 
-//Mapping from interrupter inputs to sequential rotor states. 0x00 and 0x07 are not valid
-//const int8_t stateMap[] = {0x07,0x05,0x03,0x04,0x01,0x00,0x02,0x07};
-//const int8_t stateMap[] = {0x07,0x01,0x03,0x02,0x05,0x00,0x04,0x07}; //Alternative if phase order of input or drive is reversed
-
-//Phase lead to make motor spin
-//int8_t lead = -2;  //2 for forwards, -2 for backwards
-
 //Status LED
 DigitalOut led1(LED1);
 
@@ -75,12 +63,6 @@
 InterruptIn qB(CHB);
 
 //Motor Drive outputs
-//DigitalOut L1L(L1Lpin);
-//DigitalOut L1H(L1Hpin);
-//DigitalOut L2L(L2Lpin);
-//DigitalOut L2H(L2Hpin);
-//DigitalOut L3L(L3Lpin);
-//DigitalOut L3H(L3Hpin);
 DigitalOut clk(LED1);
 DigitalOut Direction(LED2);
 DigitalOut testpin(D13);
@@ -201,23 +183,6 @@
     }
 }
 
-<<<<<<< local
-=======
-//void edgeRiseA()
-//{
-//    pos++;
-//    if(pos>=468) {
-////        Direction=!Direction;
-//        pos=pos%468;
-////        testpin=!testpin;
-//    }
-//    if(qB) DIR = 0;
-//    else DIR = 1;
-////    clk=DIR;
-////CLOCKWISE:        A rises before B -> On A edge, B low -> DIR = 1
-////ANTICLOCKWISE:    B rises before A -> On A edge, B high-> DIR = 0
-//}
-
 void sing(float singFreq)
 {
     motor = driveTable[1];
@@ -237,17 +202,7 @@
     }
 }
 
-//void edgeIncr()
-//{
-//    pos++;
-//    if(pos>=468) {
-////        Direction=!Direction;
-//        pos=pos%468;
-////        testpin=!testpin;
-//    }
-//}
 
-//#define WAIT 2
 //Main function
 >>>>>>> other
 int main()
@@ -271,14 +226,6 @@
     speedTimer.start();
     I2.mode(PullNone);
     I2.fall(&rps);
-<<<<<<< local
-=======
-
-//    qA.rise(&edgeRiseA);
-//    qB.rise(&edgeIncr);
-//    qA.fall(&edgeIncr);
-//    qB.fall(&edgeIncr);
->>>>>>> other
 
     VPIDthread.start(VPID);