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

feat(): add some configurations #178

Merged
merged 8 commits into from
Nov 5, 2024

Conversation

Allen-saltedfish
Copy link

add some configurations.
Crc16:

  • CCITT_FALSE
  • IBM
  • MAXIM
  • USB
  • X25
  • DNP

Crc8:

  • ITU
  • MAXIM
  • ROHC

@Nicoretti Nicoretti self-requested a review October 17, 2024 18:08
@Nicoretti Nicoretti self-assigned this Oct 17, 2024
@Nicoretti
Copy link
Owner

Hi @sutichunxiao,

Thanks for the PR. As I am currently a bit short on time, it might take me a while to do a full review (go over the configurations etc.). Still, before we merge the PR, we also need to extend the test suite to run a few basic tests for each of the configurations. It would be great if you could add those. The tests for the other configurations should provide sufficient examples, if not, please let me know.

Best,
Nico

@Allen-saltedfish
Copy link
Author

Dear Nico,

Thanks for your reply, I push new commit which extends test suite for new configuration. And I found some of my configuration are Repeated. Because Some configurations have aliases. I also add alias for them.

BR,
Su

@Nicoretti
Copy link
Owner

@Allen-saltedfish thanks for updating the PR. I will review it over the weekend and see if I can do a release afterwards.

@Nicoretti
Copy link
Owner

Hi @Allen-saltedfish,

As you might have seen, I have removed all of your alias doc strings. Let me give you some context why this was done.

Not all "CRC Names" indicate a very specific configuration. Sometimes there is "wiggle room", e.g. as in the case of CCITT. For example, see this comment.

Therefore, the preferred solution for adding exact aliases in the future would be to remove the unique constraint and simply add a configuration or a named reference to the set of CRC configurations.

e.g.:

class Crc16(enum.Enum):
    XMODEM = Configuration(
        width=16,
        polynomial=0x1021,
        init_value=0x0000,
        final_xor_value=0x0000,
        reverse_input=False,
        reverse_output=False,
    )

    ALIAS = XMODEM

Best,
Nico

@Nicoretti Nicoretti merged commit ffdb12c into Nicoretti:master Nov 5, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants