System Management code

Dependencies:   mbed CANBuffer Watchdog MODSERIAL mbed-rtos xbeeRelay IAP

Fork of SystemManagement by Martin Deng

Revision:
39:ddf38df9699e
Parent:
38:8efacce315ae
--- a/Libs/xbeeRelay/XbeeRelay.cpp	Sat Feb 07 08:54:51 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#include "XbeeRelay.h"
-#include "mbed.h"
-//#include "MODDMA.h"
-//#include "MODSERIAL.h"
-#include "PERMessage.h"
-
-#define MOTORCONID 0x181
-#define PCMIDLOW 0x200
-#define PCMIDHIGH 0x2FF
-
-#define MOTORCONSERIALID 0x3
-#define PCMSERIALID 0x2
-
-#define DMA_CHANNEL_XBEE_1 0
-#define DMA_CHANNEL_XBEE_2 1
-
-XbeeRelay::XbeeRelay() : Xbee_e1(p9,p10), Xbee_e2(p13,p14), counter(0) {
-   Xbee_e1.baud(250000);
-   Xbee_e2.baud(250000);
-  // Xbee_e1.MODDMA(&dma);
-   //Xbee_e2.MODDMA(&dma);
-}
-
-bool XbeeRelay::receive(CANMessage cm)  {
-    this->cm = cm;
-    
-    XbeeRelay::parse();
-    return true;//XbeeRelay::send();
-}
-
-void XbeeRelay::parseMotorCon () {
-    unsigned char *dataPtr = cm.data;
-    PERMessage pm(*dataPtr, MOTORCONSERIALID, false, cm.len - 1, (dataPtr+1)); 
-    this->pm = pm;
-}
-
-void XbeeRelay::parseNormal () {
-    unsigned char *dataPtr = cm.data;
-    PERMessage pm(cm.id & 0xFF, (cm.id & 0x700) >> 8, false, cm.len, dataPtr); 
-    this->pm = pm;
-}
-
-void XbeeRelay::parse () {
-    if (cm.id == MOTORCONID) {
-        parseMotorCon();
-    } else {
-        parseNormal();
-    }
-}
-
-bool XbeeRelay::send () {
-    char dataarr[pm.getLength() + 2];
-    pm.getDataArray(dataarr);
-    
-   /* if (!dma.Enabled(DMA_CHANNEL_XBEE_1)) {
-      //  Xbee_e1.dmaSend(dataarr, sizeof(dataarr), DMA_CHANNEL_XBEE_1);
-        return true;
-    } else if (!dma.Enabled(DMA_CHANNEL_XBEE_2)) {
-      //  Xbee_e2.dmaSend(dataarr, sizeof(dataarr), DMA_CHANNEL_XBEE_2);
-        return true;
-    }
-    */
-    return false;
-}
\ No newline at end of file