/*
 * LPI2C_I2cDrv.h
 *
 *  Created on: 2020Äê11ÔÂ14ÈÕ
 *      Author: zhou_l4
 */

#ifndef DRIVER_IIC_LPI2C_I2CDRV_H_
#define DRIVER_IIC_LPI2C_I2CDRV_H_

typedef enum IICBusRetType
{
	IIC_BUS_OK									= 0x00,
	IIC_BUS_BUSY_ERR							= 0x01,
	IIC_BUS_INTR_FLAG_ERR_SLAVE 				= 0x02,
	IIC_BUS_ACK_ERR_SLAVE						= 0x03,
	IIC_BUS_INTR_FLAG_ERR_REG_ADDR 				= 0x04,
	IIC_BUS_ACK_ERR_REG_ADDR					= 0x05,
	IIC_BUS_INTR_FLAG_ERR_DATA 					= 0x06,
	IIC_BUS_ACK_ERR_DATA						= 0x07,
	IIC_BUS_INTR_FLAG_ERR_SLAVE_READ			= 0x08,
	IIC_BUS_ACK_ERR_SLAVE_READ					= 0x09,
	IIC_BUS_READ_ERR_FIRST						= 0x0A,
	IIC_BUS_READ_ERR_CYC						= 0x0B,
	IIC_BUS_READ_ERR_CYC_PENULT					= 0x0C,
	IIC_BUS_READ_ERR_CYC_LAST					= 0x0D,
	IIC_BUS_READ_ACK_ERR_SLAVE					= 0x0E,
	IIC_BUS_READ_INTR_FLAG_ERR_REG_ADDR 		= 0x0F,
	IIC_BUS_CANNOT_USE							= 0x10,
} IIC_BUS_RET_Type;
void IIC0_PORT_init(void);
void LPI2C0_init(void);
uint8_t LPI2C0_tx(uint8_t slave_address,uint8_t *reg_buff,uint8_t reg_len,uint8_t *tx_data,uint32_t tx_data_len);
uint8_t LPI2C0_rx(uint8_t slave_address,uint8_t *reg_buff,uint8_t reg_len,uint8_t *rx_data,uint32_t rx_data_len);
void LPI2C1_init(void);
uint8_t LPI2C1_tx(uint8_t slave_address,uint8_t *reg_buff,uint8_t reg_len,uint8_t *tx_data,uint32_t tx_data_len);
uint8_t LPI2C1_rx(uint8_t slave_address,uint8_t *reg_buff,uint8_t reg_len,uint8_t *rx_data,uint32_t rx_data_len);
#endif /* DRIVER_IIC_LPI2C_I2CDRV_H_ */
