ss

Files at this revision

API Documentation at this revision

Comitter:
pfe
Date:
Tue Apr 21 10:22:19 2015 +0000
Commit message:
a

Changed in this revision

XBEE.cpp Show annotated file Show diff for this revision Revisions of this file
XBEE.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r cc6b98856c51 XBEE.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/XBEE.cpp	Tue Apr 21 10:22:19 2015 +0000
@@ -0,0 +1,31 @@
+#include "XBEE.h"
+
+XBEE::XBEE(PinName tx, PinName rx, PinName reset)
+{
+    _tx = tx;
+    _rx = rx;
+    _reset = reset;
+    _TCOMXbee = new Serial(_tx,_rx);
+}
+void XBEE::Init(unsigned int baud){
+    
+    _TCOMXbee->baud(baud);    
+    wait_ms(100);
+    Reset();
+
+}
+void XBEE::SendMSG(char *buf){
+        
+    _TCOMXbee->printf("%s",buf);    
+}
+void XBEE::RecieveMSG(char *buf){
+        
+    _TCOMXbee->printf("%s",buf);    
+}
+void XBEE::Reset(){
+    DigitalOut XbeeRST(_reset);
+    XbeeRST = 0;
+    wait_ms(10);
+    XbeeRST = 1;
+    wait_ms(1);
+}
\ No newline at end of file
diff -r 000000000000 -r cc6b98856c51 XBEE.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/XBEE.h	Tue Apr 21 10:22:19 2015 +0000
@@ -0,0 +1,20 @@
+#ifndef XBEE_H
+#define XBEE_H
+
+#include "mbed.h"
+
+class XBEE
+{
+private:
+    PinName _tx;
+    PinName _rx;
+    PinName _reset;
+    Serial* _TCOMXbee;
+public:
+    XBEE(PinName tx, PinName rx, PinName reset);    
+    void Init(unsigned int);
+    void SendMSG(char*);
+    void RecieveMSG(char*);
+    void Reset();
+};
+#endif 
\ No newline at end of file