summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/machine_i2c.c
Commit message (Collapse)AuthorAge
* extmod/machine_i2c: Add hook to constructor to call port-specific code.Damien George2016-11-24
| | | | | If MICROPY_PY_MACHINE_I2C_MAKE_NEW is defined then it is called when an I2C object is constructed with an id which is not -1.
* extmod/machine_i2c: Expose soft I2C obj and readfrom/writeto funcs.Damien George2016-11-24
| | | | For external use by ports if needed.
* extmod/machine_i2c: Remove trivial function wrappers.Damien George2016-11-23
|
* extmod/machine_i2c: Add 'stop' argument to i2c readfrom/writeto meths.Damien George2016-11-23
|
* extmod/machine_i2c: Make i2c.write[to] methods return num of ACKs recvd.Damien George2016-11-23
|
* extmod/machine_i2c: Add 'nack' argument to i2c.readinto.Damien George2016-11-23
|
* extmod/machine_i2c: Make C-level functions return -errno on I2C error.Damien George2016-11-23
|
* extmod/machine_i2c: Remove unneeded i2c_write_mem/i2c_read_mem funcs.Damien George2016-11-23
|
* extmod/machine_i2c: Rewrite mem xfer funcs in terms of C-level protocol.Damien George2016-11-23
|
* extmod/machine_i2c: Rewrite i2c.scan in terms of C-level protocol.Damien George2016-11-23
|
* extmod/machine_i2c: Add argument to C funcs to control stop generation.Damien George2016-11-23
|
* extmod/machine_i2c: Add a C-level I2C-protocol, refactoring soft I2C.Damien George2016-11-23
|
* extmod/machine_i2c: Release SDA on bus errorRadomir Dopieralski2016-11-17
|
* extmod/machine_i2c: Raise an error when clock stretching times outRadomir Dopieralski2016-11-17
|
* extmod/machine_i2c: Make the clock stretching timeout configurableRadomir Dopieralski2016-11-17
|
* extmod/machine_i2c: Use writes not reads in i2c.scan().Radomir Dopieralski2016-10-11
| | | | | | | As per discussion in #2449, using write requests instead of read requests for I2C.scan() seems to support a larger number of devices, especially ones that are write-only. Even a read-only I2C device has to implement writes in order to be able to receive the address of the register to read.
* extmod/machine_i2c: Add support for the addrsize parameter in mem xfers.Radomir Dopieralski2016-09-28
| | | | | | | | | | | | | | | | | 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.
* extmod/machine_i2c: Add clock stretching support.Radomir Dopieralski2016-09-22
| | | | | | | | | | | | | | When the clock is too fast for the i2c slave, it can temporarily hold down the scl line to signal to the master that it needs to wait. The master should check the scl line when it is releasing it after transmitting data, and wait for it to be released. This change has been tested with a logic analyzer and an i2c slace implemented on an atmega328p using its twi peripheral, clocked at 8Mhz. Without the change, the i2c communication works up to aboy 150kHz frequency, and above that results in the slave stuck in an unresponsive state. With this change, communication has been tested to work up to 400kHz.
* extmod/machine_i2c: Redo mp_hal_pin macros to use open_drain and od_low.Damien George2016-05-26
| | | | | mp_hal_pin_config_od is renamed mp_hal_pin_open_drain, and mp_hal_pin_low is mp_hal_pin_od_low.
* extmod/machine_i2c: Allow mp_hal_pin_obj_t to be any type, not a ptr.Damien George2016-04-22
|
* extmod/machine_i2c: Implement I2C memory reading/writing.Damien George2016-04-12
|
* extmod/machine_i2c: Fix I2C reading by sending ack/nack at end of byte.Damien George2016-04-12
|
* extmod: Add generic machine.I2C class, with bit-bang I2C.Damien George2016-04-12
Should work on any machine that provides the correct pin functions.