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: WRS_mechanamu_test
Diff: PacketSerial.h
- Revision:
- 0:56fce4868747
- Child:
- 2:ea92ff9abc8c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/PacketSerial.h Fri Jun 29 08:31:42 2018 +0000
@@ -0,0 +1,22 @@
+#ifndef SERIAL_H
+#define SERIAL_H
+#include "mbed.h"
+
+#define HEAD_BYTE 0x7E
+#define ESCAPE_BYTE 0x7D
+#define ESCAPE_MASK 0x20
+
+class PacketSerial : public Serial
+{
+ public:
+ PacketSerial(PinName tx, PinName rx, int32_t* registar);
+ void writeData(int32_t data, uint8_t reg);
+ void writeFloatData(float data, uint8_t reg);
+ float getFloatData(uint8_t reg);
+
+ private:
+ void readData();
+ int32_t* _registar;
+};
+
+#endif
\ No newline at end of file