diff options
author | Radomir Dopieralski <openstack@sheep.art.pl> | 2016-09-19 20:53:08 +0200 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-09-28 14:45:29 +1000 |
commit | 219245e10fa01ab81a7dd10b64fffd07e2ec1a49 (patch) | |
tree | 69523f0ef2e75184e0c0f141c8e059dad3c3817b /docs | |
parent | 7165fbd8f4e5b772d8fae6b2af9a8aad7524e81d (diff) | |
download | micropython-219245e10fa01ab81a7dd10b64fffd07e2ec1a49.tar.gz micropython-219245e10fa01ab81a7dd10b64fffd07e2ec1a49.zip |
extmod/machine_i2c: Add support for the addrsize parameter in mem xfers.
The memory read/write I2C functions now take an optional keyword-only
parameter that specifies the number of bits in the memory address.
Only mem-addrs that are a multiple of 8-bits are supported (otherwise
the behaviour is undefined).
Due to the integer type used for the address, for values larger than 32
bits, only 32 bits of address will be sent, and the rest will be padded
with 0s. Right now no exception is raised when that happens. For values
smaller than 8, no address is sent. Also no exception then.
Tested with a VL6180 sensor, which has 16-bit register addresses.
Due to code refactoring, this patch reduces stmhal and esp8266 builds
by about 50 bytes.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/library/machine.I2C.rst | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/docs/library/machine.I2C.rst b/docs/library/machine.I2C.rst index b3bfa68f07..f5820f103e 100644 --- a/docs/library/machine.I2C.rst +++ b/docs/library/machine.I2C.rst @@ -170,8 +170,7 @@ methods are convenience functions to communicate with such devices. Read `nbytes` from the slave specified by `addr` starting from the memory address specified by `memaddr`. - The argument `addrsize` specifies the address size in bits (on ESP8266 - this argument is not recognised and the address size is always 8 bits). + The argument `addrsize` specifies the address size in bits. Returns a `bytes` object with the data read. .. method:: I2C.readfrom_mem_into(addr, memaddr, buf, \*, addrsize=8) |