This library assign registar and send 4bytes data in serial. Auto attachment interruption.

Dependents:   WRS_mechanamu_test

Committer:
sgrsn
Date:
Fri Jun 29 08:31:42 2018 +0000
Revision:
0:56fce4868747
Child:
2:ea92ff9abc8c
hahaha

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sgrsn 0:56fce4868747 1 #ifndef SERIAL_H
sgrsn 0:56fce4868747 2 #define SERIAL_H
sgrsn 0:56fce4868747 3 #include "mbed.h"
sgrsn 0:56fce4868747 4
sgrsn 0:56fce4868747 5 #define HEAD_BYTE 0x7E
sgrsn 0:56fce4868747 6 #define ESCAPE_BYTE 0x7D
sgrsn 0:56fce4868747 7 #define ESCAPE_MASK 0x20
sgrsn 0:56fce4868747 8
sgrsn 0:56fce4868747 9 class PacketSerial : public Serial
sgrsn 0:56fce4868747 10 {
sgrsn 0:56fce4868747 11 public:
sgrsn 0:56fce4868747 12 PacketSerial(PinName tx, PinName rx, int32_t* registar);
sgrsn 0:56fce4868747 13 void writeData(int32_t data, uint8_t reg);
sgrsn 0:56fce4868747 14 void writeFloatData(float data, uint8_t reg);
sgrsn 0:56fce4868747 15 float getFloatData(uint8_t reg);
sgrsn 0:56fce4868747 16
sgrsn 0:56fce4868747 17 private:
sgrsn 0:56fce4868747 18 void readData();
sgrsn 0:56fce4868747 19 int32_t* _registar;
sgrsn 0:56fce4868747 20 };
sgrsn 0:56fce4868747 21
sgrsn 0:56fce4868747 22 #endif