Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: XbeeAPI Hybrid_main_FirstEdtion
Diff: XbeeApiLib.h
- Revision:
- 0:bca23ad9e6b5
- Child:
- 1:34007fc9235e
diff -r 000000000000 -r bca23ad9e6b5 XbeeApiLib.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/XbeeApiLib.h Fri Jan 20 08:13:54 2017 +0000
@@ -0,0 +1,55 @@
+/*
+XbeeAPI用シリアル通信ライブラリ
+*/
+#include "mbed.h"
+#include <string>
+
+#ifndef _XbeeApiLib_h
+#define _XbeeApiLib_h
+
+class XbeeApi{
+
+ class Address{
+ public:
+ char ADR[8];
+ char ADR16bit[2];
+ bool IsAvailable;
+ char sum;
+ };
+ public:
+ XbeeApi(PinName Tx, PinName Rx, int BaudRate);
+ void SetAddress(int Num, unsigned long HIGH, unsigned long LOW);
+ void StartPacket(char StartWith);
+ void Write(string val);
+ void Write(int val);
+ void Write(double val);
+ void Write(float val);
+ void EndPacket();
+ void ClearPacket();
+
+ void SetInterrupt(bool val);
+ void OnDataReceived();
+
+ void OnTransmitEnabled();
+
+ int HopLimit;
+
+ private:
+ int CheckSum;
+ char buf[128];
+ int ReceivedBytesCounter;
+ char RxBuf[256];
+ int itr;
+ int BytesToTransmit;
+ int NextTransmitIndex;
+ int TransmittingAddrNum;
+ bool IsTransmitting;
+
+ void WriteWithEsc(char c);
+
+ Address address[4];
+ Serial Xbee;
+};
+
+
+#endif
\ No newline at end of file