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

Raspberry Pi EEPROM example - how to calculate lengths and checksums #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

uSpike
Copy link

@uSpike uSpike commented Jul 16, 2018

Hi, this is a great project!

I have a question (and contributions maybe?)

Please see the added examples/rpi_eeprom.py file. There are certain fields that can only be computed after the build (numatoms, eeplen) and others that additionally need to parse the raw value of various fields (crc). The CRC is especially bad, since I have to do a lot of work that duplicates knowledge of the CRC:

crc_data = atom_built[:-2]
crc = crcmod.predefined.mkCrcFun('crc-16')(crc_data)
atom.update(dict(crc=crc.to_bytes(2, 'little')))

Am I missing an easier way to do this?

@YonatanRubin
Copy link

Why not just to use Contextual (to choose the data) and Adapted (For crc calculation)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants