Test1

Dependencies:   mbed

Committer:
VASKO
Date:
Mon Aug 05 10:00:04 2019 +0000
Revision:
17:d180adbbd61f
Parent:
16:459ad1bd82fd
Minor renaming.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
VASKO 16:459ad1bd82fd 1
VASKO 15:30e45bd5902e 2 #define HeaderByte 0x48
VASKO 15:30e45bd5902e 3 #define HeaderLength 5
VASKO 12:6f63e376c0aa 4
VASKO 16:459ad1bd82fd 5 #pragma pack(push, 1)//https://os.mbed.com/forum/bugs-suggestions/topic/4264/ проблема выравнивания данных
VASKO 12:6f63e376c0aa 6 typedef union {
VASKO 12:6f63e376c0aa 7 uint8_t ui8[4];
VASKO 12:6f63e376c0aa 8 int8_t i8[4];
VASKO 12:6f63e376c0aa 9 uint16_t ui16[2];
VASKO 12:6f63e376c0aa 10 int16_t i16[2];
VASKO 12:6f63e376c0aa 11 uint32_t ui32;
VASKO 12:6f63e376c0aa 12 int32_t i32;
VASKO 12:6f63e376c0aa 13 float f;
VASKO 12:6f63e376c0aa 14 } ParsType;
VASKO 12:6f63e376c0aa 15
VASKO 12:6f63e376c0aa 16 typedef struct {
VASKO 12:6f63e376c0aa 17 uint8_t cmd;
VASKO 12:6f63e376c0aa 18 ParsType pars;
VASKO 12:6f63e376c0aa 19 uint8_t cs;
VASKO 12:6f63e376c0aa 20 } MsgType;
VASKO 16:459ad1bd82fd 21 #pragma pack(pop)
VASKO 15:30e45bd5902e 22
VASKO 16:459ad1bd82fd 23 #define ArrTxSize (HeaderLength + sizeof(MsgType))
VASKO 16:459ad1bd82fd 24 #define ArrRxSize (HeaderLength + sizeof(MsgType))
VASKO 16:459ad1bd82fd 25
VASKO 16:459ad1bd82fd 26 enum StartTxStates {
VASKO 16:459ad1bd82fd 27 StartOK,
VASKO 16:459ad1bd82fd 28 TxBusy,
VASKO 16:459ad1bd82fd 29 Undefined
VASKO 16:459ad1bd82fd 30 };
VASKO 16:459ad1bd82fd 31
VASKO 16:459ad1bd82fd 32 #define ArrTxInitializer {0x2D,HeaderByte,HeaderByte,HeaderByte,0x3D}
VASKO 16:459ad1bd82fd 33 #define ArrRxInitializer {}
VASKO 16:459ad1bd82fd 34
VASKO 15:30e45bd5902e 35 extern MsgType RxBuff;
VASKO 15:30e45bd5902e 36 extern bool RxBuffFull;
VASKO 15:30e45bd5902e 37 extern StartTxStates StartTx(uint8_t *parr);
VASKO 15:30e45bd5902e 38 extern void TxRxServiceInit();
VASKO 15:30e45bd5902e 39 extern uint8_t GetCheckSum(uint8_t *p);