Test1

Dependencies:   mbed

TxRxService.h

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

File content as of revision 16:459ad1bd82fd:

    
#define HeaderByte 0x48
#define HeaderLength 5

#pragma pack(push, 1)//https://os.mbed.com/forum/bugs-suggestions/topic/4264/  проблема выравнивания данных
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;
#pragma pack(pop)

#define ArrTxSize (HeaderLength + sizeof(MsgType))
#define ArrRxSize (HeaderLength + sizeof(MsgType))

enum StartTxStates {
    StartOK,
    TxBusy,
    Undefined
    };

#define ArrTxInitializer {0x2D,HeaderByte,HeaderByte,HeaderByte,0x3D}
#define ArrRxInitializer {}

extern MsgType RxBuff;
extern bool RxBuffFull;
extern StartTxStates StartTx(uint8_t *parr);
extern void TxRxServiceInit();
extern uint8_t GetCheckSum(uint8_t *p);