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.
Diff: OmniPosition.h
- Revision:
- 10:a21aa2bd05c5
- Parent:
- 9:222f7fcbd05a
- Child:
- 14:16ee2a638ecb
diff -r 222f7fcbd05a -r a21aa2bd05c5 OmniPosition.h
--- a/OmniPosition.h Tue Sep 18 15:25:05 2018 +0000
+++ b/OmniPosition.h Sat Oct 06 05:00:58 2018 +0000
@@ -3,38 +3,34 @@
#include "mbed.h"
-#include "SerialMultiByte.h"
+#define OP_SERIAL_BUFFER_SIZE 9
+#define OP_HEADER_FIRST_BYTE 72
+#define OP_HEADER_SECOND_BYTE 42
+#define OP_DEFAULT_BAUD 115200
-#define FIRST_HEDDER 0xEE
-#define SECOND_HEDDER 0xFF
-#define BUFFER_SIZE 6
-#define TWO_BYTE_DATA 3
-#define ONE_BYTE_DATA 0
+class OmniPosition : public RawSerial {
+ public:
+ OmniPosition(PinName serialTX, PinName serialRX);
-class OmniPosition
-{
-public :
- OmniPosition(PinName serialTX, PinName serialRX);
+ int16_t getX();
+ int16_t getY();
+ float getTheta();
- int16_t getX();
- int16_t getY();
- float getTheta();
+ void reset();
- void reset();
-
-private :
- void assembleLoop();
+ private:
+ DigitalOut debugled;
+ void receiveByte();
+ void checkData();
- Thread thread;
-
- int16_t X;
- int16_t Y;
- int16_t theta;
-
- bool resetSend;
- uint8_t rxdata[BUFFER_SIZE];
- int data[TWO_BYTE_DATA + ONE_BYTE_DATA];
- SerialMultiByte serial;
+ uint8_t buffer[9];
+ uint8_t bufferSize;
+ uint8_t bufferPoint;
+ uint8_t receivedBytes;
+ int16_t X;
+ int16_t Y;
+ int16_t theta;
};
-#endif
\ No newline at end of file
+#endif
+