/***********************************************************************************************************
 * Copyright (c)  2021 - 2022, Unicmicro Co.,Ltd .
 * All rights reserved.
 * Filename    : i2c.c
 * Description : i2c driver header file
 * Author(s)   : yanhaihua
 * Version     : V1.0
 * Modify date : 2021-09-24
 ***********************************************************************************************************/
#ifndef __I2C_H__
#define __I2C_H__

#include  "config.h"

#ifdef UM2080F32_USING_I2C

typedef enum
{
    I2C_SPEED_STAD 									= 0,
    I2C_SPEED_FAST,
    I2C_SPEED_HIGH
}em_i2c_speed_t;

void i2c_master_init(em_i2c_speed_t speed);

uint8_t i2c_master_send(uint8_t dev_addr, uint8_t *buff, uint32_t len);

uint8_t i2c_master_recv(uint8_t dev_addr,uint8_t *buff, uint32_t len);

uint8_t i2c_master_send_mix(uint8_t dev_addr, uint8_t addr, uint8_t *buff, uint16_t len);

uint8_t i2c_master_recv_mix(uint8_t dev_addr, uint8_t addr, uint8_t *buff, uint16_t len);

void i2c_slave_init(uint8_t dev_addr);

uint8_t i2c_slave_send_data(uint8_t *buff, uint16_t len);

uint8_t i2c_slave_recv_data(uint8_t *buff, uint16_t len);

#endif
#endif
