Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endian dependens #3

Open
Jonas-Meyer97 opened this issue Mar 7, 2022 · 1 comment
Open

Endian dependens #3

Jonas-Meyer97 opened this issue Mar 7, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@Jonas-Meyer97
Copy link
Contributor

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
@ceremcem
Copy link
Owner

ceremcem commented Mar 7, 2022

I read a little bit history about that and it seems like this Little/Big endian dictation is not clarified. Adding an endianness configuration would be nice. However, I've no test setup ATM to implement/test this option. I will add such an option as soon as possible, but I can't promise any time frame.

@ceremcem ceremcem added the enhancement New feature or request label Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants