Committer:
sgrsn
Date:
Sat Jun 25 03:00:02 2016 +0000
Revision:
0:bfa17897e6e5
multi bytes serial telecommunication

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sgrsn 0:bfa17897e6e5 1 #ifndef MULTISERIAL_H
sgrsn 0:bfa17897e6e5 2 #define MULTISERIAL_H
sgrsn 0:bfa17897e6e5 3 #include "mbed.h"
sgrsn 0:bfa17897e6e5 4
sgrsn 0:bfa17897e6e5 5 class MultiSerial : public Serial
sgrsn 0:bfa17897e6e5 6 {
sgrsn 0:bfa17897e6e5 7 public:
sgrsn 0:bfa17897e6e5 8 MultiSerial(PinName TX, PinName RX);// : Serial(TX, RX)
sgrsn 0:bfa17897e6e5 9 /*{
sgrsn 0:bfa17897e6e5 10 }*/
sgrsn 0:bfa17897e6e5 11 double getc();
sgrsn 0:bfa17897e6e5 12 /*{
sgrsn 0:bfa17897e6e5 13 UNION obj;
sgrsn 0:bfa17897e6e5 14 for(int i = 0; i < 8; i++)
sgrsn 0:bfa17897e6e5 15 {
sgrsn 0:bfa17897e6e5 16 obj.c[i] = Serial::getc();
sgrsn 0:bfa17897e6e5 17 }
sgrsn 0:bfa17897e6e5 18 return obj.d;
sgrsn 0:bfa17897e6e5 19 }*/
sgrsn 0:bfa17897e6e5 20 void putc(double data);
sgrsn 0:bfa17897e6e5 21 /*{
sgrsn 0:bfa17897e6e5 22 UNION obj;
sgrsn 0:bfa17897e6e5 23 obj.d = data;
sgrsn 0:bfa17897e6e5 24 for(int i = 0; i < sizeof(data); i++)
sgrsn 0:bfa17897e6e5 25 {
sgrsn 0:bfa17897e6e5 26 Serial::putc(obj.c[i]);
sgrsn 0:bfa17897e6e5 27 }
sgrsn 0:bfa17897e6e5 28 }*/
sgrsn 0:bfa17897e6e5 29
sgrsn 0:bfa17897e6e5 30 private:
sgrsn 0:bfa17897e6e5 31 union UNION
sgrsn 0:bfa17897e6e5 32 {
sgrsn 0:bfa17897e6e5 33 double d;
sgrsn 0:bfa17897e6e5 34 float f;
sgrsn 0:bfa17897e6e5 35 int i;
sgrsn 0:bfa17897e6e5 36 char c[8];
sgrsn 0:bfa17897e6e5 37 };
sgrsn 0:bfa17897e6e5 38 };
sgrsn 0:bfa17897e6e5 39
sgrsn 0:bfa17897e6e5 40 #endif