forked from epsylon3/android_external_i2c-tools
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Adding I²C write_i2c_block and read_i2c_block methods #1
Open
kaklik
wants to merge
33
commits into
costad2:master
Choose a base branch
from
MLAB-project:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…py to properly link against the libi2c library
This adds mode 'i' for I2C_SMBUS_I2C_BLOCK_DATA. This is the same mode letter from i2cdump. Length is optional and defaults to 32 (maximum). The indended use is debugging i2c devices with shell commands.
…5-17) Specific warning: warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE Maybe both should have been defined: "To allow code that requires _BSD_SOURCE in glibc 2.19 and earlier and _DEFAULT_SOURCE in glibc 2.20 and later to compile without warnings, define both _BSD_SOURCE and _DEFAULT_SOURCE." Source: http://man7.org/linux/man-pages/man7/feature_test_macros.7.html at june 28th 2016.
By default current implementations of python smbus does not allow a i2c module to set i2c-address unless all kernel module references are removed. When such condition exists, python throws error like 'Device or resource busy'. But i2cget tool allows to open i2c address forcefully by a flag '-y'. This allows the shell script developers to read/write a i2c device at their own risk. But similar option is not in python smbus module (though it would be risky, if used unknowingly/inappropriately). This change allows such option in python code. Patch is 3 liner change. No interfaces were added . Developer just needs to set an environemnt variable named 'PY_SMBUS' with non-null string before calling SMBus(i2c-dev-bus-number). I have used this changed code to write a python program that queries the 9$ Chip computer's AXP209 I2C module for data collection wrt to battery
Usage of this python smbus module in 9$ Chip's axp209 module is in https://github.com/GssMahadevan/chip_axp209_tool
…ansaction in functions SMBus_write_i2c_block and SMBus_read_i2c_block.
…2c_master_recv functions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The write_i2c_block and read_i2c_block methods are required for some true I²C sensors like SHT31 or SDP610.