Some devices, eg BNO055, can stretch SCL for a long time, so make the
default large to accommodate them. 50ms matches the current default for
stm32 hardware I2C .
Signed-off-by: Damien George <damien@micropython.org>
Latest versions of Sphinx (at least 3.1.0) do not need the `*` escaped and
will render the `\` in the output if it is there, so remove it.
Fixes issue #6209.
This allows to efficiently send to an I2C slave data that is made up of
more than one buffer. Instead of needing to allocate temporary memory to
combine buffers together this new method allows to pass in a tuple or list
of buffers. The name is based on the POSIX function writev() which has
similar intentions and signature.
The reasons for taking this approach (compared to having an interface with
separate start/write/stop methods) are:
- It's a backwards compatible extension.
- It's convenient for the user.
- It's efficient because there is only one Python call, then the C code can
do everything in one go.
- It's efficient on the I2C bus because the implementation can do
everything in one go without pauses between blocks of bytes.
- It should be possible to implement this extension in all ports, for
hardware and software I2C.
Further discussion is found in issue #3482, PR #4020 and PR #4763.
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.
A standard I2C address is 7 bits but addresses 0b0000xxx and 0b1111xxx
are reserved. The scan() method is changed to reflect this, along with
the docs.