Has ANYONE found any better documentation on smbus than that erazer wiki site? The page there is from 2006, and is very rudimentary. I'm trying to figure out, for instance, what the parameters for the commands are (esp. The 'cmd' parameter). The pydoc site is even more useless, as it has nothing on smbus. Driver download page for the ATI SMBus by Video. To use the I2C library, you need to: #include. In your program. Programs need to be linked with -lwiringPi as usual. You can still use the standard system commands to check the I2C devices, and I recommend you do so – e.g. The i2cdetect program.
smbus2 - A drop-in replacement for smbus-cffi/smbus-python
smbus2.
SMBus
(bus=None, force=False)¶block_process_call
(i2c_addr, register, data, force=None)¶Executes a SMBus Block Process Call, sending a variable-size datablock and receiving another variable-size response
Parameters: |
|
---|---|
Returns: | List of bytes |
Return type: | list |
close
()¶Close the i2c connection.
enable_pec
(enable=True)¶Enable/Disable PEC (Packet Error Checking) - SMBus 1.1 and later
Parameters: | enable (Boolean) – |
---|
i2c_rdwr
(*i2c_msgs)¶Combine a series of i2c read and write operations in a singletransaction (with repeated start bits but no stop bits in between).
This method takes i2c_msg instances as input, which must be createdfirst with i2c_msg.read()
or i2c_msg.write()
.
Parameters: | i2c_msgs (i2c_msg) – One or more i2c_msg class instances. |
---|---|
Return type: | None |
open
(bus)¶Open a given i2c bus.
Parameters: | bus (int or str) – i2c bus number (e.g. 0 or 1)or an absolute file path (e.g. ‘/dev/i2c-42'). |
---|---|
Raises: | TypeError – if type(bus) is not in (int, str) |
pec
¶Get and set SMBus PEC. 0 = disabled (default), 1 = enabled.
process_call
(i2c_addr, register, value, force=None)¶Executes a SMBus Process Call, sending a 16-bit value and receiving a 16-bit response
Parameters: |
|
---|---|
Return type: |
read_block_data
(i2c_addr, register, force=None)¶Read a block of up to 32-bytes from a given register.
Parameters: |
|
---|---|
Returns: | List of bytes |
Return type: | list |
read_byte
(i2c_addr, force=None)¶Read a single byte from a device.
Return type: | |
---|---|
Parameters: |
|
Returns: | Read byte value |
read_byte_data
(i2c_addr, register, force=None)¶Read a single byte from a designated register.
Parameters: |
|
---|---|
Returns: | Read byte value |
Return type: |
read_i2c_block_data
(i2c_addr, register, length, force=None)¶Read a block of byte data from a given register.
Parameters: |
|
---|---|
Returns: | List of bytes |
Return type: | list |
read_word_data
(i2c_addr, register, force=None)¶Read a single word (2 bytes) from a given register.
Parameters: |
|
---|---|
Returns: | 2-byte word |
Return type: |
write_block_data
(i2c_addr, register, data, force=None)¶Write a block of byte data to a given register.
Parameters: |
|
---|---|
Return type: |
write_byte
(i2c_addr, value, force=None)¶Write a single byte to a device.
Parameters: |
|
---|
write_byte_data
(i2c_addr, register, value, force=None)¶Write a byte to a given register.
Parameters: |
|
---|---|
Return type: |
write_i2c_block_data
(i2c_addr, register, data, force=None)¶Write a block of byte data to a given register.
Parameters: |
|
---|---|
Return type: |
I2c Smbus Library
write_quick
(i2c_addr, force=None)¶Perform quick transaction. Throws IOError if unsuccessful.:param i2c_addr: i2c address:type i2c_addr: int:param force::type force: Boolean
write_word_data
(i2c_addr, register, value, force=None)¶smbus2.
SMBus
(bus=None, force=False)¶block_process_call
(i2c_addr, register, data, force=None)¶Executes a SMBus Block Process Call, sending a variable-size datablock and receiving another variable-size response
Parameters: |
|
---|---|
Returns: | List of bytes |
Return type: | list |
close
()¶Close the i2c connection.
enable_pec
(enable=True)¶Enable/Disable PEC (Packet Error Checking) - SMBus 1.1 and later
Parameters: | enable (Boolean) – |
---|
i2c_rdwr
(*i2c_msgs)¶Combine a series of i2c read and write operations in a singletransaction (with repeated start bits but no stop bits in between).
This method takes i2c_msg instances as input, which must be createdfirst with i2c_msg.read()
or i2c_msg.write()
.
Parameters: | i2c_msgs (i2c_msg) – One or more i2c_msg class instances. |
---|---|
Return type: | None |
open
(bus)¶Open a given i2c bus.
Parameters: | bus (int or str) – i2c bus number (e.g. 0 or 1)or an absolute file path (e.g. ‘/dev/i2c-42'). |
---|---|
Raises: | TypeError – if type(bus) is not in (int, str) |
pec
¶Get and set SMBus PEC. 0 = disabled (default), 1 = enabled.
process_call
(i2c_addr, register, value, force=None)¶Executes a SMBus Process Call, sending a 16-bit value and receiving a 16-bit response
Parameters: |
|
---|---|
Return type: |
read_block_data
(i2c_addr, register, force=None)¶Read a block of up to 32-bytes from a given register.
Parameters: |
|
---|---|
Returns: | List of bytes |
Return type: | list |
read_byte
(i2c_addr, force=None)¶Read a single byte from a device.
Return type: | |
---|---|
Parameters: |
|
Returns: | Read byte value |
read_byte_data
(i2c_addr, register, force=None)¶Read a single byte from a designated register.
Parameters: |
|
---|---|
Returns: | Read byte value |
Return type: |
read_i2c_block_data
(i2c_addr, register, length, force=None)¶Read a block of byte data from a given register.
Parameters: |
|
---|---|
Returns: | List of bytes |
Return type: | list |
read_word_data
(i2c_addr, register, force=None)¶Read a single word (2 bytes) from a given register.
Parameters: |
|
---|---|
Returns: | 2-byte word |
Return type: |
write_block_data
(i2c_addr, register, data, force=None)¶Write a block of byte data to a given register.
Parameters: |
|
---|---|
Return type: |
write_byte
(i2c_addr, value, force=None)¶Write a single byte to a device.
Parameters: |
|
---|
write_byte_data
(i2c_addr, register, value, force=None)¶Write a byte to a given register.
Parameters: |
|
---|---|
Return type: |
write_i2c_block_data
(i2c_addr, register, data, force=None)¶Write a block of byte data to a given register.
Parameters: |
|
---|---|
Return type: |
I2c Smbus Library
write_quick
(i2c_addr, force=None)¶Perform quick transaction. Throws IOError if unsuccessful.:param i2c_addr: i2c address:type i2c_addr: int:param force::type force: Boolean
write_word_data
(i2c_addr, register, value, force=None)¶Write a single word (2 bytes) to a given register.
Parameters: |
|
---|---|
Return type: |
smbus2.
i2c_msg
¶As defined in i2c.h
.
addr
¶Structure/Union member
buf
¶Structure/Union member
flags
¶Structure/Union member
Raspberry Pi Python Smbus Library
len
¶Structure/Union member
read
(address, length)¶Micropython Smbus Library
Prepares an i2c read transaction.
Parameters: |
|
---|---|
Type: | address: int |
Type: | length: int |
Returns: | New |
Return type: |
write
(address, buf)¶Prepares an i2c write transaction.
Parameters: |
|
---|---|
Returns: | New |
Return type: |