1 #ifndef PCA9544_I2C_DRV_H
2 #define PCA9544_I2C_DRV_H
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 /* ===== System include ===== */
9 #include "aos/hal/i2c.h"
10 
11 /* ===== API Lists ===== */
12 /**********************************************************
13  * @fun    pca9544_i2c_init
14  * @breif  pca9544 i2c initialization
15  * @param  i2c:the pointer for i2c configuration
16  * @rtn    0 : on success, EIO : error
17  *********************************************************/
18 int32_t pca9544_i2c_init(i2c_dev_t *i2c);
19 
20 /********************************************************
21  * @fun    pca9544_i2c_master_send
22  *
23  * @param[in]  i2c            the i2c device
24  * @param[in]  dev_addr       device address
25  * @param[in]  data           i2c master send data
26  * @param[in]  size           i2c master send data size
27  * @param[in]  timeout        timeout in milisecond, set this value to
28  *HAL_WAIT_FOREVER if you want to wait forever
29  *
30  * @rtn    0 : on success, EIO : error
31  *********************************************************/
32 int32_t pca9544_i2c_master_send(i2c_dev_t *i2c, uint16_t dev_addr, const uint8_t *data, uint16_t size, uint32_t timeout);
33 
34 /********************************************************
35  * @fun    pca9544_i2c_master_recv
36  *
37  * @param[in]  i2c            the i2c device
38  * @param[in]  dev_addr       device address
39  * @param[in]  data           i2c master recv data
40  * @param[in]  size           i2c master recv data size
41  * @param[in]  timeout        timeout in milisecond, set this value to
42  *HAL_WAIT_FOREVER if you want to wait forever
43  *
44  * @rtn    0 : on success, EIO : error
45  *********************************************************/
46 int32_t pca9544_i2c_master_recv(i2c_dev_t *i2c, uint16_t dev_addr, uint8_t *data, uint16_t size, uint32_t timeout);
47 
48 /*********************************************************
49  * @fun    pca9544_i2c_mem_write
50  * @param[in]  i2c            the i2c device
51  * @param[in]  dev_addr       device address
52  * @param[in]  mem_addr       register address
53  * @param[in]  mem_addr_size  register address size
54  * @param[in]  data           i2c master send data
55  * @param[in]  size           i2c master send data size
56  * @param[in]  timeout        timeout in milisecond, set this value to
57  *HAL_WAIT_FOREVER if you want to wait forever
58  *
59  * @rtn    0 : on success, EIO : error
60  *********************************************************/
61 int32_t pca9544_i2c_mem_write(i2c_dev_t *i2c, uint16_t dev_addr, uint16_t mem_addr, uint16_t mem_addr_size, const uint8_t* data, uint16_t size, uint32_t timeout);
62 
63 /*********************************************************
64  * @fun    pca9544_i2c_mem_read
65  * @param[in]  i2c            the i2c device
66  * @param[in]  dev_addr       device address
67  * @param[in]  mem_addr       register address
68  * @param[in]  mem_addr_size  register address size
69  * @param[in]  data           i2c master send data
70  * @param[in]  size           i2c master send data size
71  * @param[in]  timeout        timeout in milisecond, set this value to
72  *HAL_WAIT_FOREVER if you want to wait forever
73  *
74  * @rtn    0 : on success, EIO : error
75  *********************************************************/
76 int32_t pca9544_i2c_mem_read(i2c_dev_t *i2c, uint16_t dev_addr, uint16_t mem_addr, uint16_t mem_addr_size, uint8_t* data, uint16_t size, uint32_t timeout);
77 
78 /********************************************************
79  * @fun    pca9544_i2c_finalize
80  * @param[in]  i2c            the i2c device
81  * @rtn    0 : on success, EIO : error
82  *********************************************************/
83 int32_t pca9544_i2c_finalize(i2c_dev_t *i2c);
84 
85 #ifdef __cplusplus
86 }
87 #endif /* __cplusplus */
88 
89 #endif /* PCA9544_I2C_DRV_H */
90