Test1

Dependencies:   mbed

Committer:
VASKO
Date:
Sun Aug 04 14:09:35 2019 +0000
Revision:
14:b113f676ef42
Parent:
13:b9e066badefa
Child:
15:30e45bd5902e
One-level Tx bufferization by "TxBuff". Tx control by "StartTx". TxInit optimization by "CopyArr_InitTx".

Who changed what in which revision?

UserRevisionLine numberNew contents of line
VASKO 12:6f63e376c0aa 1 #define HeaderByte 0
VASKO 12:6f63e376c0aa 2 #define HeaderByteQty 5
VASKO 12:6f63e376c0aa 3 #define MsgCmdSize 1
VASKO 12:6f63e376c0aa 4 #define MsgParsSize 4
VASKO 12:6f63e376c0aa 5 #define MsgCS_Size 1
VASKO 12:6f63e376c0aa 6
VASKO 12:6f63e376c0aa 7 #define ArrTxSize (HeaderByteQty + MsgCmdSize + MsgParsSize + MsgCS_Size)
VASKO 12:6f63e376c0aa 8 #define ArrRxSize (HeaderByteQty + MsgCmdSize + MsgParsSize + MsgCS_Size)
VASKO 12:6f63e376c0aa 9
VASKO 14:b113f676ef42 10 enum StartTxStates {
VASKO 14:b113f676ef42 11 StartOK,
VASKO 14:b113f676ef42 12 TxBusy,
VASKO 14:b113f676ef42 13 Undefined
VASKO 14:b113f676ef42 14 };
VASKO 12:6f63e376c0aa 15
VASKO 12:6f63e376c0aa 16 //#define ArrTxInitializer {0x20,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4b,0x4c,0x4d,0x4e,0x4f}
VASKO 12:6f63e376c0aa 17 #define ArrTxInitializer {}
VASKO 12:6f63e376c0aa 18 //#define ArrRxInitializer {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
VASKO 12:6f63e376c0aa 19 #define ArrRxInitializer {}
VASKO 11:6519744c77f9 20
VASKO 11:6519744c77f9 21 extern uint8_t RxBuff[ArrRxSize];
VASKO 11:6519744c77f9 22 extern uint8_t TxBuff[ArrTxSize];
VASKO 13:b9e066badefa 23 extern bool RxBuffFull;
VASKO 11:6519744c77f9 24 extern bool ArrTxBusy;
VASKO 11:6519744c77f9 25 extern bool TxBuffFull;
VASKO 14:b113f676ef42 26 extern StartTxStates StartTx(uint8_t *parr);
VASKO 12:6f63e376c0aa 27 extern void TxRxServiceInit();
VASKO 12:6f63e376c0aa 28
VASKO 14:b113f676ef42 29 //typedef uint8_t TxArrType[ArrTxSize];
VASKO 12:6f63e376c0aa 30 typedef union {
VASKO 12:6f63e376c0aa 31 uint8_t ui8[4];
VASKO 12:6f63e376c0aa 32 int8_t i8[4];
VASKO 12:6f63e376c0aa 33 uint16_t ui16[2];
VASKO 12:6f63e376c0aa 34 int16_t i16[2];
VASKO 12:6f63e376c0aa 35 uint32_t ui32;
VASKO 12:6f63e376c0aa 36 int32_t i32;
VASKO 12:6f63e376c0aa 37 float f;
VASKO 12:6f63e376c0aa 38 } ParsType;
VASKO 12:6f63e376c0aa 39
VASKO 12:6f63e376c0aa 40 typedef struct {
VASKO 12:6f63e376c0aa 41 uint8_t cmd;
VASKO 12:6f63e376c0aa 42 ParsType pars;
VASKO 12:6f63e376c0aa 43 uint8_t cs;
VASKO 12:6f63e376c0aa 44 } MsgType;
VASKO 12:6f63e376c0aa 45