Simple xbee library based on the Serial class with added reset signaling

Dependents:   m3Dpi

Files at this revision

API Documentation at this revision

Comitter:
sillevl
Date:
Fri Nov 06 18:49:29 2015 +0000
Commit message:
simple xbee class with reset;

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 a4621ef93d99 xbee.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xbee.cpp	Fri Nov 06 18:49:29 2015 +0000
@@ -0,0 +1,21 @@
+#include "xbee.h"
+
+
+Xbee::Xbee(PinName tx, PinName rx, PinName _reset, const char* name) : Serial(tx, rx, name), rst(_reset)
+{
+    disable();
+}
+
+void Xbee::enable(){
+    rst = 1;
+}
+
+void Xbee::disable(){
+    rst = 0;
+}
+
+void Xbee::reset(){
+    disable();
+    wait_ms(1);
+    enable();
+}
\ No newline at end of file
diff -r 000000000000 -r a4621ef93d99 xbee.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xbee.h	Fri Nov 06 18:49:29 2015 +0000
@@ -0,0 +1,15 @@
+#include "mbed.h"
+
+class Xbee : public Serial{
+    
+    public:
+    Xbee(PinName tx, PinName rx, PinName reset, const char* name = NULL);
+    
+    void enable();
+    void disable();
+    void reset();
+    
+    protected:
+    DigitalOut rst;
+    
+};
\ No newline at end of file