terry LAI / Mbed 2 deprecated ESDC2014-pwm

Dependencies:   mbed

Fork of ESDC2014 by terry LAI

Revision:
4:a377ecb9364f
Parent:
3:4306d042af6f
Child:
5:098e6a44bd94
--- a/port.h	Thu Jul 03 14:52:44 2014 +0000
+++ b/port.h	Fri Jul 04 13:05:15 2014 +0000
@@ -27,6 +27,7 @@
 **********************************************************/
 #include "mbed.h"
 #include "define.h"
+#include "compass.h"
 
 #ifndef _PORT_H
 #define _PORT_H
@@ -34,7 +35,6 @@
 MyDigitalOut IntelToMbed_LED(LED1); //uart port LED between Intel Board and Mbed
 MyDigitalOut MbedToArduino_LED(LED2); //uart port LED between Mbed and Arduino
 MySerial DEBUG(USBTX, USBRX); //usb serial port between computer and Mbed
-MySerial CompassData(p9, p10); ////uart port between compass and Mbed
 MySerial IntelToMbed(p13, p14); //uart port between Intel Board and Mbed
 MySerial MbedToArduino(p28, p27); //uart port between Mbed and Arduino
 MyPwmOut lifter_pwmUp(p21);
@@ -49,7 +49,9 @@
 
 MyDigitalOut buzzer_pin(p29);
 Buzzer buzzer(&buzzer_pin);
-COMPASS compass(&CompassData);
+
+
+Compass compass(CompassData);
 
 Communication com(&DEBUG, &IntelToMbed, &MbedToArduino, &compass);
 Lifter lifter(&lifter_enable, &lifter_pwmUp, &lifter_pwmDown, &lifter_encoder_A, &lifter_encoder_B);
@@ -69,14 +71,15 @@
     com.putToBuffer(_x, 1); //function inside Communication::
     //__enable_irq();
 }
-void compassHandler()
+void CompassDataRxHandler()
 {
-    //__disable_irq();//disable interupt when receiving data from XBEE_UART
+    //__disable_irq();
     uint8_t _x = CompassData.getc();
-    compass.putToBuffer(_x); //function inside Communication::
+    compass.putToBuffer(_x);
     //__enable_irq();
 }
 
+
 void LifterPulseHandler()
 {
     if(lifter.pulseCount < lifter.targetPulseCount)
@@ -102,7 +105,7 @@
 void init_PORT() //used in main() function
 {
     DEBUG.baud(9600);
-    
+    printf("&CompassData %p...\r\n",&CompassData);
     IntelToMbed.baud(9600);
     IntelToMbed.attach(&IntelToMbedRxHandler); //serial interrupt function
     
@@ -110,7 +113,7 @@
     MbedToArduino.attach(&MbedToArduinoRxHandler); //serial interrupt function
     
     CompassData.baud(56000);
-    CompassData.attach(&compassHandler);
+    CompassData.attach(&CompassDataRxHandler);
     
     lifter_encoder_A.fall(&LifterPulseHandler); //interrupt