diff options
Diffstat (limited to 'extmod/machine_i2c.h')
| -rw-r--r-- | extmod/machine_i2c.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/extmod/machine_i2c.h b/extmod/machine_i2c.h index 03fa6422a..c971f4b19 100644 --- a/extmod/machine_i2c.h +++ b/extmod/machine_i2c.h @@ -29,6 +29,17 @@ #include "py/obj.h" +// I2C protocol +// the first 4 methods can be NULL, meaning operation is not supported +typedef struct _mp_machine_i2c_p_t { + int (*start)(mp_obj_base_t *obj); + int (*stop)(mp_obj_base_t *obj); + int (*read)(mp_obj_base_t *obj, uint8_t *dest, size_t len); + int (*write)(mp_obj_base_t *obj, const uint8_t *src, size_t len); + int (*readfrom)(mp_obj_base_t *obj, uint16_t addr, uint8_t *dest, size_t len, bool stop); + int (*writeto)(mp_obj_base_t *obj, uint16_t addr, const uint8_t *src, size_t len, bool stop); +} mp_machine_i2c_p_t; + extern const mp_obj_type_t machine_i2c_type; #endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H__ |
