Telliskivi 2 2014

Dependencies:   DoubleCoilGun 4DGL-uLCD-SE ExternalIn HumanInterfaceT14 LedOut MCP3021 MODSERIAL Motor1Pwm1Dir PCA9555 PinDetect QED RgbLedPCA9555 WDT_K64F mbed-src

Fork of Telliskivi2plus by Reiko Randoja

Revision:
7:a9e98f642a89
Parent:
6:5619aff36840
Child:
8:06124632c3e4
--- a/main.cpp	Mon Nov 04 21:23:42 2013 +0000
+++ b/main.cpp	Mon Nov 04 23:57:09 2013 +0000
@@ -6,7 +6,6 @@
 #include "PCA9555.h"
 #include "motor.h"
 #include "qed.h"
-#include "ballsens.h"
 #include "ledout.h"
 #include "externalin.h"
 #include "coilgun.h"
@@ -33,7 +32,6 @@
 
 
 volatile int update = 0;
-volatile int extInChanged = 0;
 
 volatile int stallChanged = 0;
 
@@ -83,18 +81,10 @@
     update = 1;
 }
 
-void extChangedCallback() {
-    extInChanged = 1;
-}
-
 void stallChangedCallback() {
     stallChanged = 1;
 }
 
-//BallSens ballSens(&ioExt, 10);
-//ExternalIn button1(&ioExt, 14);
-//ExternalIn button2(&ioExt, 15);
-
 UDPSocket server;
 Endpoint client;
 char buffer[256];
@@ -139,7 +129,6 @@
 int main (void) {
     pc.baud(115200);
     EthernetInterface eth;
-    //eth.init(); //Use DHCP
     eth.init("192.168.4.1", "255.255.255.0", "192.168.4.8");
     eth.connect();
     printf("IP Address is %s\n", eth.getIPAddress());
@@ -193,26 +182,12 @@
     //pc.printf("ioExt: %x\n", ioExt.read());
     //pc.printf("ioExt: %s\n", byte_to_binary(ioExt.read()));
     
-    //ballSens.change(&extChangedCallback);
-    //button1.change(&extChangedCallback);
-    //button2.change(&extChangedCallback);
-    
-    //humanInterface.change(&extChangedCallback);
-    
     motor1.stallChange(&stallChangedCallback);
     motor2.stallChange(&stallChangedCallback);
     motor3.stallChange(&stallChangedCallback);
     motor4.stallChange(&stallChangedCallback);
     motor5.stallChange(&stallChangedCallback);
     
-    //InterruptIn change(p8);
-    //change.rise(&ballCallBack);
-    //change.fall(&ballCallBack);
-    
-    
-    //redLed.set();
-    //blueLed.set();
-    //yellowLed.set();
     
     //int charCount = sprintf(sendBuffer, "<ready>");
     //server.sendTo(client, sendBuffer, charCount);
@@ -222,14 +197,10 @@
     led1 = 1;
     
     while (1) {
-        //coilgun.kick(5000);
-        //kickFinish.detach();
-        //kickFinish.attach_us(&coilgun, &CoilGun::kickEnd, 1000);
     
         if (update) {
             update = 0;
             ioExt.writePins();
-            //coilgun.kick(100);
             
             failSafeCount++;
             if (failSafeCount == failSafeLimit) {
@@ -243,7 +214,6 @@
                     coilgun.discharge();
                 }  
                 if (!coilgun.isCharged) {
-                    //int charCount = sprintf(sendBuffer, "<speeds:%d:%d:%d:%d:%d>");
                     server.sendTo(client, "<discharged>", 12);
                 } 
             }
@@ -303,13 +273,6 @@
         if (humanInterface.isStart()) {
             server.sendTo(client, "<toggle-go>", 11);
         }
-        
-        /*if (extInChanged) {
-            extInChanged = 0;     
-            bool ballState = humanInterface.getBallState();
-            int charCount = sprintf(sendBuffer, "<ioExt:%x>", ioExt.getLastRead());
-            server.sendTo(client, sendBuffer, charCount);        
-        }*/
     
         //printf("\nWait for packet...\n");