diff options
| author | thread-liu <[email protected]> | 2020-12-11 18:08:56 +0800 |
|---|---|---|
| committer | thread-liu <[email protected]> | 2020-12-11 18:08:56 +0800 |
| commit | 3ab2d4fb1ff4779a59f2fa3e2f8168582e617626 (patch) | |
| tree | 7e97747d70dd1691135b22135be97f423064e0a2 /components/drivers/include | |
| parent | a06f1fa627564ce9f1059047e4c484141354e252 (diff) | |
| parent | 42088b010a3eccd099fe96956196ed62ffd5fbf5 (diff) | |
Merge branch 'master' of https://github.com/RT-Thread/rt-thread into step4-ev1
Diffstat (limited to 'components/drivers/include')
| -rw-r--r-- | components/drivers/include/drivers/i2c.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/components/drivers/include/drivers/i2c.h b/components/drivers/include/drivers/i2c.h index 17d57288cd..d93e82fc2b 100644 --- a/components/drivers/include/drivers/i2c.h +++ b/components/drivers/include/drivers/i2c.h @@ -23,6 +23,7 @@ extern "C" { #define RT_I2C_NO_START (1u << 4) #define RT_I2C_IGNORE_NACK (1u << 5) #define RT_I2C_NO_READ_ACK (1u << 6) /* when I2C reading, we do not ACK */ +#define RT_I2C_NO_STOP (1u << 7) struct rt_i2c_msg { @@ -83,6 +84,17 @@ rt_size_t rt_i2c_master_recv(struct rt_i2c_bus_device *bus, rt_uint16_t flags, rt_uint8_t *buf, rt_uint32_t count); + +rt_inline rt_err_t rt_i2c_bus_lock(struct rt_i2c_bus_device *bus, rt_tick_t timeout) +{ + return rt_mutex_take(&bus->lock, timeout); +} + +rt_inline rt_err_t rt_i2c_bus_unlock(struct rt_i2c_bus_device *bus) +{ + return rt_mutex_release(&bus->lock); +} + int rt_i2c_core_init(void); #ifdef __cplusplus |
