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.
ComLink.h
- Committer:
- gert_lauritsen
- Date:
- 2016-02-26
- Revision:
- 1:30b8effc5d74
- Parent:
- 0:c9f3777fe0b4
- Child:
- 2:c1599cad82c3
File content as of revision 1:30b8effc5d74:
//------------------------------------------------------------------------------------
// :
// 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 "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