init

Revision:
0:c9f3777fe0b4
Child:
1:30b8effc5d74
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ComLink.h	Thu Nov 05 12:47:33 2015 +0000
@@ -0,0 +1,76 @@
+//------------------------------------------------------------------------------------
+//                       :     
+// Title                 :   Comlink 
+// Filename              :   Queue.h
+// Author                :   Gert Lauritsen
+// Origin Date           :   26/05/2015
+// Version               :   1.000
+// Compiler              :   Keil
+// Target                :   
+// Notes                 :   None
+//
+//------------------------------------------------------------------------------------
+
+#ifndef ComLink_H
+#define ComLink_H
+
+#include <Queue.h>
+#include "ComQueue.h"
+#include "mbed.h"
+
+#define RxSize 200
+#define stx 2
+//------------------------------------------------------------------------------------
+
+typedef void (*callback_type)(int);
+/*
+Modtagne data:
+1: Kp, Ki,Kd
+2: Vset            float 
+3: SetSpeed Manual byte 0..100
+4: ReadTempetur
+//Når vi modtager data vil type blive send i callback
+
+Sender:
+1: ID, Firmware,
+2: CalRecord, Vmax, PowerOn, PowerStart,  
+3: Gui, Vout, Iout, Irotor, Temp, Vbat, 
+4: Send ErrStateArr
+5: Send SetStateArr
+6: Write LCD
+7: Clear LCD
+
+*/
+//------------------------------------------------------------------------------------
+
+class ComLink {
+private:
+ callback_type callback;
+ RawSerial _com;
+ char inbuff[RxSize];
+ void rxCallback();
+ void txCallback();
+ bool CRC(); //check af inkommende frames
+ bool TxAktiv;
+ void Senddata(unsigned char Dtype, unsigned char Dsize, char *str); 
+ void TxFloats(unsigned char Ftype, float *Fvalue, int Size);
+ 
+public:
+ char Data[RxSize];
+ unsigned char DSize;
+ ComLink(PinName tx, PinName rx,callback_type _callback);
+ //void Updategui();
+ 
+ //Sender
+ void StatusUpdate(float Vout,float Iout,float Irotor,float Temp,float Vbat);
+ void TxErrStateArr(float *value, int Size);
+ void TxSetStateArr(float *value, int Size);
+ 
+ void TxCalRecord(float *value, int Size);
+ void TxStatus(float *value, int Size);
+ 
+ void WriteLCD(unsigned char x,unsigned char y, char *str);
+ void cls(); 
+};
+
+#endif
\ No newline at end of file