diff options
| author | Tero Kontkanen <tero.kontkanen@granitedevices.fi> | 2016-10-28 15:18:37 +0300 |
|---|---|---|
| committer | Tero Kontkanen <tero.kontkanen@granitedevices.fi> | 2016-10-28 15:18:37 +0300 |
| commit | f629f3a69e092a9299fd0d70dddd2efa6bbee2e7 (patch) | |
| tree | 0392c5a173b9f5e32115b764ceafcb559d2d2ef3 /simplemotion_private.h | |
| parent | 0490facebd118837d821d8d382dafc16cba475dc (diff) | |
| parent | fa9c9212d7e25e9eacbbfcc4e6a516b4d48ebbb5 (diff) | |
| download | SimpleMotionV2-f629f3a69e092a9299fd0d70dddd2efa6bbee2e7.tar.gz SimpleMotionV2-f629f3a69e092a9299fd0d70dddd2efa6bbee2e7.zip | |
Merge branch 'develop'
Diffstat (limited to 'simplemotion_private.h')
| -rw-r--r-- | simplemotion_private.h | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/simplemotion_private.h b/simplemotion_private.h index d1e37a3..e46dc1c 100644 --- a/simplemotion_private.h +++ b/simplemotion_private.h @@ -30,6 +30,7 @@ #define BUSDEV_FTDI 2 /*not implemented yet: direct FTDI lib support*/
#define SM_BUSDEVICENAME_LEN 64
+extern unsigned long SMBusBaudrate; //the next opened port (with smOpenBus) will be opened with the PBS defined here (default 460800 BPS)
//default timeout in ms
//Argon drive's worst case response time should be ~20ms with max length packets
@@ -46,6 +47,13 @@ void smDebug( smbus handle, smVerbosityLevel verbositylevel, char *format, ...); SM_STATUS smRawCmd( const char *axisname, smuint8 cmd, smuint16 val, smuint32 *retdata );
+/*Workaround to have packed structs that compile on GCC and MSVC*/
+#ifdef __GNUC__
+#define PACKED __attribute__ ((__packed__))
+#else/*Assuming MSVC*/
+#define PACKED
+#pragma pack(push,1)
+#endif
typedef struct {
/* ID=0 param size 30 bits (cmd total 4 bytes)
@@ -55,7 +63,7 @@ typedef struct { */
long param :30; //LSB 30 bits
long ID:2; //MSB 2 bits. when serailzied to bytestream byte4 must be transmitted first to contain ID
-} __attribute__ ((packed)) SMPayloadCommand32;
+} PACKED SMPayloadCommand32;
typedef struct {
/* ID=0 param size 30 bits (cmd total 4 bytes)
@@ -65,7 +73,7 @@ typedef struct { */
long param :14; //LSB 30 bits
long ID:2; //MSB 2 bits. when serailzied to bytestream byte4 must be transmitted first to contain ID
-} __attribute__ ((packed)) SMPayloadCommand16;
+} PACKED SMPayloadCommand16;
typedef struct {
/* ID=0 param size 30 bits (cmd total 4 bytes)
@@ -75,7 +83,7 @@ typedef struct { */
long param :22; //MSB 30 bits
long ID:2; //MSB 2 bits. when serailzied to bytestream byte4 must be transmitted first to contain ID
-} __attribute__ ((packed)) SMPayloadCommand24;
+} PACKED SMPayloadCommand24;
//SM payload command return data structure
typedef struct {
@@ -86,7 +94,8 @@ typedef struct { */
long retData: 30; //LSB 30 bits
long ID:2; //MSB 2 bits. when serailzied to bytestream byte4 must be transmitted first to contain ID
-} __attribute__ ((packed)) SMPayloadCommandRet32;
+} PACKED SMPayloadCommandRet32;
+
//SM payload command return data structure
typedef struct {
/* ID=0 ret data 30 bits (tot 4 bytes)
@@ -96,7 +105,8 @@ typedef struct { */
long retData: 22; //LSB 30 bits
long ID:2; //MSB 2 bits. when serailzied to bytestream byte4 must be transmitted first to contain ID
-} __attribute__ ((packed)) SMPayloadCommandRet24;
+} PACKED SMPayloadCommandRet24;
+
//SM payload command return data structure
typedef struct {
/* ID=0 ret data 30 bits (tot 4 bytes)
@@ -106,7 +116,8 @@ typedef struct { */
long retData: 14; //LSB 30 bits
long ID:2; //MSB 2 bits. when serailzied to bytestream byte4 must be transmitted first to contain ID
-} __attribute__ ((packed)) SMPayloadCommandRet16;
+} PACKED SMPayloadCommandRet16;
+
//SM payload command return data structure
typedef struct {
/* ID=0 ret data 30 bits (tot 4 bytes)
@@ -116,6 +127,14 @@ typedef struct { */
long retData: 6; //LSB 30 bits
long ID:2; //MSB 2 bits. when serailzied to bytestream byte4 must be transmitted first to contain ID
-} __attribute__ ((packed)) SMPayloadCommandRet8;
+} PACKED SMPayloadCommandRet8;
+
+/*Workaround to have packed structs that compile on GCC and MSVC*/
+#ifdef __GNUC__
+#else/*Assuming MSVC*/
+#pragma pack(pop)
+#undef PACKED
+#endif
+
#endif // SIMPLEMOTION_PRIVATE_H
|
