Files
New_STC32G_All_Board/Header/iic_soft.h
2025-08-31 21:37:24 +08:00

21 lines
506 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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