Commit Graph

16 Commits

Author SHA1 Message Date
Damien George
8bec0e869d docs/machine.I2C: Add writevto method to write a vector of byte bufs.
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.
2019-05-20 14:51:56 +10:00
Peter Hinch
163bacd1e8 docs/library/machine.I2C.rst: Clarify availability of primitive I2C ops. 2018-08-04 15:53:12 +10:00
Paul Sokolovsky
7c0e1f1a08 docs/machine*: Use markup adhering to the latest docs conventions. 2017-06-25 13:30:29 +03:00
Damien George
850f79e552 docs/library/machine.I2C: Remove WiPy-specific return values.
cc3200 has been updated to conform to the API and now returns None.
2017-04-18 15:39:27 +10:00
Damien George
d4675e7674 docs/library/machine.*: Add cross-reference label to individual classes. 2017-04-18 15:27:37 +10:00
Damien George
1f1a03d0c3 docs/library/machine.I2C: Deconditionalise all methods.
The cc3200 port is now similar enough to the standard machine.I2C API so
that all conditionals can be removed.
2017-04-18 15:04:51 +10:00
transistortim
fb981107eb docs/library/machine.I2C: Fix scan() doc to match implementation.
Since eaef6b5324 writes are used instead of
reads.
2017-03-20 15:30:41 +11:00
Damien George
d377c83794 docs/library/machine.I2C: Fix I2C constructor docs to match impl. 2016-12-30 15:25:48 +11:00
Damien George
63a5df3cb4 docs/library/machine.I2C: Refine definitions of I2C methods. 2016-11-23 17:05:02 +11:00
Radomir Dopieralski
219245e10f 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.
2016-09-28 14:45:29 +10:00
Paul Sokolovsky
79b40d1127 docs/machine*: Remove explicit targets and "machine." prefixes on classes.
With currentmodule:: set properly, none are needed. Extra "machine." prefix
produces wrong indexing data.
2016-06-09 03:03:53 +03:00
Paul Sokolovsky
7d7243f44c docs/machine.*: Use proper class case in method headers.
Class designator will be used as is in indexes, so must match actual class
name.
2016-06-08 01:33:49 +03:00
Paul Sokolovsky
c8b7628094 docs/machine.*: Add "currentmodule:: machine" directive.
Makes sure that classes described in these separate files are properly
designated as belonging to "machine" module in indexes.
2016-06-08 00:46:27 +03:00
Damien George
c816b89353 docs/library/machine.I2C: Update to reflect ESP8266 implementation.
This machine.I2C documentation is now closer to a more port-neutral
description, although there are still differences between WiPy and
ESP8266.
2016-05-02 12:31:17 +01:00
Damien George
70ff7350e7 stmhal, cc3200: Change i2c.scan() method to scan addresses 0x08-0x77.
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.
2016-05-02 11:15:36 +01:00
danicampora
4542643025 docs: Update all WiPy docs to reflect the new API. 2015-10-17 23:29:04 +02:00