diff options
| author | Bernard Xiong <[email protected]> | 2020-12-10 22:44:04 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-12-10 22:44:04 +0800 |
| commit | e2d951ad2a83df7ded34b9ea0db7ef6aa66859e3 (patch) | |
| tree | 9f2105815f873b03b9de5b607a0e15917abcf3e5 /components/drivers/i2c | |
| parent | 2bedb0b24d043b482ef92de538ca88c1f8cfe71b (diff) | |
| parent | 54c6e7d1459c2e4e6e4e6249e1700837c3d863a3 (diff) | |
Merge pull request #3929 from geniusgogo/i2c_update
[dirver/i2c] i2c driver support bus lock, STOP control
Diffstat (limited to 'components/drivers/i2c')
| -rw-r--r-- | components/drivers/i2c/i2c-bit-ops.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/components/drivers/i2c/i2c-bit-ops.c b/components/drivers/i2c/i2c-bit-ops.c index 99338eef54..96af567a1e 100644 --- a/components/drivers/i2c/i2c-bit-ops.c +++ b/components/drivers/i2c/i2c-bit-ops.c @@ -375,8 +375,6 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus, rt_int32_t i, ret; rt_uint16_t ignore_nack; - LOG_D("send start condition"); - i2c_start(ops); for (i = 0; i < num; i++) { msg = &msgs[i]; @@ -387,6 +385,11 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus, { i2c_restart(ops); } + else + { + LOG_D("send start condition"); + i2c_start(ops); + } ret = i2c_bit_send_address(bus, msg); if ((ret != RT_EOK) && !ignore_nack) { @@ -423,8 +426,11 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus, ret = i; out: - LOG_D("send stop condition"); - i2c_stop(ops); + if (!(msg->flags & RT_I2C_NO_STOP)) + { + LOG_D("send stop condition"); + i2c_stop(ops); + } return ret; } |
