summaryrefslogtreecommitdiff
path: root/extmod/machine_i2c.h
AgeCommit message (Collapse)Author
2020-11-23extmod/machine_i2c: Add init protocol method for generic I2C bindings.Damien George
Hardware I2C implementations must provide a .init() protocol method if they want to support reconfiguration. Otherwise the default is that i2c.init() raises an OSError (currently the case for all ports). mp_machine_soft_i2c_locals_dict is renamed to mp_machine_i2c_locals_dict to match the generic SPI bindings. Fixes issue #6623 (where calling .init() on a HW I2C would crash). Signed-off-by: Damien George <damien@micropython.org>
2020-10-01ports: Support legacy soft I2C/SPI construction via id=-1 arg.Damien George
With a warning that this way of constructing software I2C/SPI is deprecated. The check and warning will be removed in a future release. This should help existing code to migrate to the new SoftI2C/SoftSPI types. Signed-off-by: Damien George <damien@micropython.org>
2020-10-01extmod/machine_i2c: Rename type to SoftI2C and add custom print method.Damien George
Also rename machine_i2c_type to mp_machine_soft_i2c_type. These changes make it clear that it's a soft-I2C implementation, and match SoftSPI. Signed-off-by: Damien George <damien@micropython.org>
2019-05-20extmod/machine_i2c: Change C-level API to allow split I2C transactions.Damien George
API is: int transfer( mp_obj_base_t *obj, uint16_t addr, size_t n, mp_machine_i2c_buf_t *bufs, unsigned int flags )
2017-07-18all: Unify header guard usage.Alexander Steffen
The code conventions suggest using header guards, but do not define how those should look like and instead point to existing files. However, not all existing files follow the same scheme, sometimes omitting header guards altogether, sometimes using non-standard names, making it easy to accidentally pick a "wrong" example. This commit ensures that all header files of the MicroPython project (that were not simply copied from somewhere else) follow the same pattern, that was already present in the majority of files, especially in the py folder. The rules are as follows. Naming convention: * start with the words MICROPY_INCLUDED * contain the full path to the file * replace special characters with _ In addition, there are no empty lines before #ifndef, between #ifndef and one empty line before #endif. #endif is followed by a comment containing the name of the guard macro. py/grammar.h cannot use header guards by design, since it has to be included multiple times in a single C file. Several other files also do not need header guards as they are only used internally and guaranteed to be included only once: * MICROPY_MPHALPORT_H * mpconfigboard.h * mpconfigport.h * mpthreadport.h * pin_defs_*.h * qstrdefs*.h
2016-11-24extmod/machine_i2c: Expose soft I2C obj and readfrom/writeto funcs.Damien George
For external use by ports if needed.
2016-11-23extmod/machine_i2c: Add 'nack' argument to i2c.readinto.Damien George
2016-11-23extmod/machine_i2c: Add a C-level I2C-protocol, refactoring soft I2C.Damien George
2016-04-12extmod: Add generic machine.I2C class, with bit-bang I2C.Damien George
Should work on any machine that provides the correct pin functions.