Test1

Dependencies:   mbed

TxRxService.h

Committer:
VASKO
Date:
2019-08-04
Revision:
15:30e45bd5902e
Parent:
14:b113f676ef42
Child:
16:459ad1bd82fd

File content as of revision 15:30e45bd5902e:

#define HeaderByte 0x48
#define HeaderLength 5
#define MsgCmdSize 1
#define MsgParsSize 4
#define MsgCS_Size 1

#define ArrTxSize (HeaderLength + MsgCmdSize + MsgParsSize + MsgCS_Size)
#define ArrRxSize (HeaderLength + MsgCmdSize + MsgParsSize + MsgCS_Size)

enum StartTxStates {
    StartOK,
    TxBusy,
    Undefined
    };

//#define ArrTxInitializer {0x20,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4b,0x4c,0x4d,0x4e,0x4f}
#define ArrTxInitializer {0x2D,HeaderByte,HeaderByte,HeaderByte,0x3D}
//#define ArrRxInitializer {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
#define ArrRxInitializer {}

//typedef uint8_t TxArrType[ArrTxSize];

typedef union {
    uint8_t ui8[4];
    int8_t i8[4];
    uint16_t ui16[2];
    int16_t i16[2];
    uint32_t ui32;
    int32_t i32;
    float f;
    } ParsType;
  
typedef struct {
    uint8_t cmd;
    ParsType pars;
    uint8_t cs;
    } MsgType;

//extern uint8_t RxBuff[ArrRxSize];
extern MsgType RxBuff;
//extern uint8_t TxBuff[ArrTxSize];
extern MsgType TxBuff;
extern bool RxBuffFull;
extern bool ArrTxBusy;
extern bool TxBuffFull;
extern StartTxStates StartTx(uint8_t *parr);
extern void TxRxServiceInit();
extern uint8_t GetCheckSum(uint8_t *p);