@@ -257,8 +257,10 @@ MODBUS_API void modbus_mapping_free(modbus_mapping_t *mb_mapping);
257257MODBUS_API int
258258modbus_send_raw_request (modbus_t * ctx , const uint8_t * raw_req , int raw_req_length );
259259
260- MODBUS_API int
261- modbus_send_raw_request_tid (modbus_t * ctx , const uint8_t * raw_req , int raw_req_length , int tid );
260+ MODBUS_API int modbus_send_raw_request_tid (modbus_t * ctx ,
261+ const uint8_t * raw_req ,
262+ int raw_req_length ,
263+ int tid );
262264
263265MODBUS_API int modbus_receive (modbus_t * ctx , uint8_t * req );
264266
@@ -278,31 +280,31 @@ MODBUS_API int modbus_disable_quirks(modbus_t *ctx, unsigned int quirks_mask);
278280 **/
279281
280282#define MODBUS_GET_HIGH_BYTE (data ) (((data) >> 8) & 0xFF)
281- #define MODBUS_GET_LOW_BYTE (data ) ((data) &0xFF)
282- #define MODBUS_GET_INT64_FROM_INT16 (tab_int16 , index ) \
283- (((int64_t) tab_int16[(index)] << 48) | ((int64_t) tab_int16[(index) + 1] << 32) | \
284- ((int64_t) tab_int16[(index) + 2] << 16) | (int64_t) tab_int16[(index) + 3])
283+ #define MODBUS_GET_LOW_BYTE (data ) ((data) & 0xFF)
284+ #define MODBUS_GET_INT64_FROM_INT16 (tab_int16 , index ) \
285+ (((int64_t) tab_int16[(index)] << 48) | ((int64_t) tab_int16[(index) + 1] << 32) | \
286+ ((int64_t) tab_int16[(index) + 2] << 16) | (int64_t) tab_int16[(index) + 3])
285287#define MODBUS_GET_INT32_FROM_INT16 (tab_int16 , index ) \
286- (((int32_t) tab_int16[(index)] << 16) | (int32_t) tab_int16[(index) + 1])
288+ (((int32_t) tab_int16[(index)] << 16) | (int32_t) tab_int16[(index) + 1])
287289#define MODBUS_GET_INT16_FROM_INT8 (tab_int8 , index ) \
288- (((int16_t) tab_int8[(index)] << 8) | (int16_t) tab_int8[(index) + 1])
289- #define MODBUS_SET_INT16_TO_INT8 (tab_int8 , index , value ) \
290- do { \
291- ((int8_t *) (tab_int8))[(index)] = (int8_t) ((value) >> 8); \
292- ((int8_t *) (tab_int8))[(index) + 1] = (int8_t) (value); \
293- } while (0)
294- #define MODBUS_SET_INT32_TO_INT16 (tab_int16 , index , value ) \
295- do { \
296- ((int16_t *) (tab_int16))[(index)] = (int16_t) ((value) >> 16); \
297- ((int16_t *) (tab_int16))[(index) + 1] = (int16_t) (value); \
298- } while (0)
299- #define MODBUS_SET_INT64_TO_INT16 (tab_int16 , index , value ) \
300- do { \
301- ((int16_t *) (tab_int16))[(index)] = (int16_t) ((value) >> 48); \
302- ((int16_t *) (tab_int16))[(index) + 1] = (int16_t) ((value) >> 32); \
303- ((int16_t *) (tab_int16))[(index) + 2] = (int16_t) ((value) >> 16); \
304- ((int16_t *) (tab_int16))[(index) + 3] = (int16_t) (value); \
305- } while (0)
290+ (((int16_t) tab_int8[(index)] << 8) | (int16_t) tab_int8[(index) + 1])
291+ #define MODBUS_SET_INT16_TO_INT8 (tab_int8 , index , value ) \
292+ do { \
293+ ((int8_t *) (tab_int8))[(index)] = (int8_t) ((value) >> 8); \
294+ ((int8_t *) (tab_int8))[(index) + 1] = (int8_t) (value); \
295+ } while (0)
296+ #define MODBUS_SET_INT32_TO_INT16 (tab_int16 , index , value ) \
297+ do { \
298+ ((int16_t *) (tab_int16))[(index)] = (int16_t) ((value) >> 16); \
299+ ((int16_t *) (tab_int16))[(index) + 1] = (int16_t) (value); \
300+ } while (0)
301+ #define MODBUS_SET_INT64_TO_INT16 (tab_int16 , index , value ) \
302+ do { \
303+ ((int16_t *) (tab_int16))[(index)] = (int16_t) ((value) >> 48); \
304+ ((int16_t *) (tab_int16))[(index) + 1] = (int16_t) ((value) >> 32); \
305+ ((int16_t *) (tab_int16))[(index) + 2] = (int16_t) ((value) >> 16); \
306+ ((int16_t *) (tab_int16))[(index) + 3] = (int16_t) (value); \
307+ } while (0)
306308
307309MODBUS_API void modbus_set_bits_from_byte (uint8_t * dest , int idx , const uint8_t value );
308310MODBUS_API void modbus_set_bits_from_bytes (uint8_t * dest ,
0 commit comments