diff options
| author | Damien George <damien.p.george@gmail.com> | 2016-11-24 00:11:45 +1100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2016-11-24 00:11:45 +1100 |
| commit | 8b74048d2a94bf254a49504a8c11a65fd5ec322f (patch) | |
| tree | 55d61bff74685f6c0d025d762a7483850b073302 /extmod/machine_i2c.h | |
| parent | 4c905616f08fa29d83e2fc2c0b2a5233c998e008 (diff) | |
extmod/machine_i2c: Expose soft I2C obj and readfrom/writeto funcs.
For external use by ports if needed.
Diffstat (limited to 'extmod/machine_i2c.h')
| -rw-r--r-- | extmod/machine_i2c.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/extmod/machine_i2c.h b/extmod/machine_i2c.h index 39f485834..d49ff01e4 100644 --- a/extmod/machine_i2c.h +++ b/extmod/machine_i2c.h @@ -40,6 +40,18 @@ typedef struct _mp_machine_i2c_p_t { int (*writeto)(mp_obj_base_t *obj, uint16_t addr, const uint8_t *src, size_t len, bool stop); } mp_machine_i2c_p_t; +typedef struct _mp_machine_soft_i2c_obj_t { + mp_obj_base_t base; + uint32_t us_delay; + uint32_t us_timeout; + mp_hal_pin_obj_t scl; + mp_hal_pin_obj_t sda; +} mp_machine_soft_i2c_obj_t; + extern const mp_obj_type_t machine_i2c_type; +extern const mp_obj_dict_t mp_machine_soft_i2c_locals_dict; + +int mp_machine_soft_i2c_readfrom(mp_obj_base_t *self_in, uint16_t addr, uint8_t *dest, size_t len, bool stop); +int mp_machine_soft_i2c_writeto(mp_obj_base_t *self_in, uint16_t addr, const uint8_t *src, size_t len, bool stop); #endif // __MICROPY_INCLUDED_EXTMOD_MACHINE_I2C_H__ |
