This repository was archived by the owner on Sep 30, 2019. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull fixes a couple small issues:
getPiRevision's check for the revision 1 boards should check for revisions ending in '2' or '3' instead of '1' or '2'. This is based on the revision info from here: http://elinux.org/RPi_HardwareHistory#Board_Revision_History and looking at the latest quick2wire-python-api code which also now checks for 2 or 3.
readS16 was actually returning unsigned values. This fixes the function so it returns a signed value, and adds an optional little_endian=True or False parameter (defaults to true). The endian parameter will make it explicit what endianness the caller desires since the underlying I2C read system calls assume little endian (which causes problems when reading big endian data like BMP085 sensor calibration).
Note that this is a potentially breaking change for code which currently uses readS16 and unknowingly depends on it actually returning incorrect unsigned values. I searched the Adafruit github code and don't see anything depending the function so it should be safe to change. For folks that have code that depends on this bug I think it's best to still make this fix and help them update their code going forward (either switching to readU16 or using readS16 with signed data correctly).