结构体

struct  aos_i2c_msg_t
 

宏定义

#define AOS_I2C_MCFG_TX   ((uint32_t)0x0 << 0)
 
#define AOS_I2C_MCFG_RX   ((uint32_t)0x1 << 0)
 
#define AOS_I2C_MCFG_ADDR_7   ((uint32_t)0x0 << 1)
 
#define AOS_I2C_MCFG_ADDR_10   ((uint32_t)0x1 << 1)
 
#define AOS_I2C_MSG_INIT_VAL
 
#define aos_i2c_msg_init(x)   do { *(x) = (aos_i2c_msg_t)AOS_I2C_MSG_INIT_VAL; } while (0)
 

类型定义

typedef aos_dev_ref_t aos_i2c_ref_t
 

函数

aos_status_t aos_i2c_get (aos_i2c_ref_t *ref, uint32_t id)
 Get a I2C device. 更多...
 
void aos_i2c_put (aos_i2c_ref_t *ref)
 Release a I2C device. 更多...
 
aos_status_t aos_i2c_transfer (aos_i2c_ref_t *ref, const aos_i2c_msg_t *msgs, size_t num_msgs)
 Synchronous I2C data transfer. 更多...
 

详细描述

给应用提供I2C操作的AOS API.

宏定义说明

◆ AOS_I2C_MCFG_ADDR_10

#define AOS_I2C_MCFG_ADDR_10   ((uint32_t)0x1 << 1)

在文件 i2c.h21 行定义.

◆ AOS_I2C_MCFG_ADDR_7

#define AOS_I2C_MCFG_ADDR_7   ((uint32_t)0x0 << 1)

在文件 i2c.h20 行定义.

◆ AOS_I2C_MCFG_RX

#define AOS_I2C_MCFG_RX   ((uint32_t)0x1 << 0)

在文件 i2c.h19 行定义.

◆ AOS_I2C_MCFG_TX

#define AOS_I2C_MCFG_TX   ((uint32_t)0x0 << 0)

在文件 i2c.h18 行定义.

◆ aos_i2c_msg_init

#define aos_i2c_msg_init (   x)    do { *(x) = (aos_i2c_msg_t)AOS_I2C_MSG_INIT_VAL; } while (0)

在文件 i2c.h40 行定义.

◆ AOS_I2C_MSG_INIT_VAL

#define AOS_I2C_MSG_INIT_VAL
值:
{ \
.cfg = 0, \
.addr = 0, \
.count = 0, \
.buf = NULL, \
}

在文件 i2c.h32 行定义.

类型定义说明

◆ aos_i2c_ref_t

typedef aos_dev_ref_t aos_i2c_ref_t

在文件 i2c.h23 行定义.

函数说明

◆ aos_i2c_get()

aos_status_t aos_i2c_get ( aos_i2c_ref_t ref,
uint32_t  id 
)

Get a I2C device.

参数
[out]refI2C ref to operate
[in]idI2C device ID
返回
0: on success; < 0: on failure

◆ aos_i2c_put()

void aos_i2c_put ( aos_i2c_ref_t ref)

Release a I2C device.

参数
[in]refI2C ref to operate
返回
None

◆ aos_i2c_transfer()

aos_status_t aos_i2c_transfer ( aos_i2c_ref_t ref,
const aos_i2c_msg_t msgs,
size_t  num_msgs 
)

Synchronous I2C data transfer.

参数
[in]refI2C ref to operate
[in]msgsarray of messages
[in]num_msgsnumber of messages
返回
0: on success; < 0: on failure