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.
Diff: TxRxService.h
- Revision:
- 16:459ad1bd82fd
- Parent:
- 15:30e45bd5902e
- Child:
- 19:09c21f5f0625
--- a/TxRxService.h Sun Aug 04 15:43:47 2019 +0000
+++ b/TxRxService.h Sun Aug 04 18:01:47 2019 +0000
@@ -1,25 +1,8 @@
+
#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];
-
+#pragma pack(push, 1)//https://os.mbed.com/forum/bugs-suggestions/topic/4264/ проблема выравнивания данных
typedef union {
uint8_t ui8[4];
int8_t i8[4];
@@ -35,14 +18,22 @@
ParsType pars;
uint8_t cs;
} MsgType;
+#pragma pack(pop)
-//extern uint8_t RxBuff[ArrRxSize];
+#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 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);
\ No newline at end of file