Skip to content

correct register width when retrieving calibration register (fixes #30) #32

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

Conversation

MattyJeronimo
Copy link
Contributor

Register width parameter of call to i2c_bits.RWBits specifies the width of the register in bytes. However, in the following call, register width is passed as 8.

_calibration = i2c_bits.RWBits(8, 0x10, 0, 8, signed=True)

This results in an 8 byte register (64 bit). This fails on feather m0 adalogger because maximum integer value for a python int on this platform is (2^30)-1

The register should only be 1 byte, the 8 is probably a typo because the other arguments passed are in bits.

Fixes: #30

@ladyada ladyada requested a review from jepler November 30, 2020 01:49
@travisby
Copy link

travisby commented Dec 2, 2020

I can't speak to the correctness of the change, but I can say that with this patch my gemma M0 that was previously failing to import ds3231 now succeeds :).

Thanks for the fix @MattyJeronimo !

Copy link
Contributor

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @MattyJeronimo and thanks for testing @travisby !

@jepler jepler merged commit 4f5dc66 into adafruit:master Dec 16, 2020
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Dec 17, 2020
Updating https://github.com/adafruit/Adafruit_CircuitPython_AS7341 to 1.0.1 from 1.0.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_AS7341#2 from mcauser/patch-1
  > Removed deprecated pylint disable 'bad-whitespace'

Updating https://github.com/adafruit/Adafruit_CircuitPython_DHT to 3.5.2 from 3.5.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_DHT#56 from yeyeto2788/fix_issue_32

Updating https://github.com/adafruit/Adafruit_CircuitPython_DS3231 to 2.4.2 from 2.4.1:
  > Merge pull request adafruit/Adafruit_CircuitPython_DS3231#32 from MattyJeronimo/mjeronimo/fix-cortex-m0-register-width-error

Updating https://github.com/adafruit/Adafruit_CircuitPython_INA219 to 3.4.6 from 3.4.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_INA219#26 from WizardTim/master

Updating https://github.com/adafruit/Adafruit_CircuitPython_SCD30 to 1.0.2 from 1.0.1:
  > fixing typo and adding i2c stop for register read

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bitmap_Font to 1.3.1 from 1.3.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_Bitmap_Font#33 from FoamyGuy/pcf_examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

small int overflow on non-longint board
3 participants