21 lines
506 B
C
21 lines
506 B
C
#ifndef __IIC_SOFT_H__
|
||
#define __IIC_SOFT_H__
|
||
|
||
#include "common.h"
|
||
#include "gpio.h"
|
||
|
||
typedef struct
|
||
{
|
||
PIN_enum scl_pin; // SCL引脚
|
||
PIN_enum sda_pin; // SDA引脚
|
||
uint16 wait_time; // 等待时间,用于I2C总线速度控制
|
||
} IIC_Soft_Config;
|
||
|
||
void soft_iic_init(IIC_Soft_Config *config);
|
||
|
||
uint8 soft_iic_read_reg(IIC_Soft_Config *config, uint8 dev_addr, uint8 reg_addr, uint8 *dat);
|
||
|
||
void soft_iic_write_reg(IIC_Soft_Config *config, uint8 dev_addr, uint8 reg_addr, uint8 dat);
|
||
|
||
#endif
|