Skip to content

Endian dependens #3

@Jonas-Meyer97

Description

@Jonas-Meyer97

I implemented the modbus library into my project and noticed while debugging that the union CRC_t, MbDataField is endian dependent. It would really help if the dependence on endianness would be documented in comments and Readme/Usage guide.
Also is there any plan to implement some sort of configuration with macros like

#ifndef LITTLE_ENDIAN
	#define LITTLE_ENDIAN 1234
#endif

#ifndef BIG_ENDIAN
	#define BIG_ENDIAN 4321
#endif

#ifndef BYTE_ORDER
	#define BYTE_ORDER LITTLE_ENDIAN
#endif

#if BYTE_ORDER == LITTLE_ENDIAN
    struct {
        uint8_t low;
        uint8_t high;
    } bytes;
#else
    struct {
        uint8_t high;
        uint8_t low;
    } bytes;
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions