//定义IIC类
typedef struct IIC_Type
{
//属性
GPIO_TypeDef *GPIOx_SCL; //GPIO_SCL所属的GPIO组(如:GPIOA)
GPIO_TypeDef *GPIOx_SDA; //GPIO_SDA所属的GPIO组(如:GPIOA)
uint32_t GPIO_SCL; //GPIO_SCL的IO引脚(如:GPIO_PIN_0)
uint32_t GPIO_SDA; //GPIO_SDA的IO引脚(如:GPIO_PIN_0)
//操作
void (*IIC_Init)(const struct IIC_Type*); //IIC_Init
void (*IIC_Start)(const struct IIC_Type*); //IIC_Start
void (*IIC_Stop)(const struct IIC_Type*); //IIC_Stop
uint8_t (*IIC_Wait_Ack)(const struct IIC_Type*); //IIC_Wait_ack,返回wait失败或是成功
void (*IIC_Ack)(const struct IIC_Type*); //IIC_Ack,IIC发送ACK信号
void (*IIC_NAck)(const struct IIC_Type*); //IIC_NAck,IIC发送NACK信号
void (*IIC_Send_Byte)(const struct IIC_Type*,uint8_t); //IIC_Send_Byte,入口参数为要发送的字节
uint8_t (*IIC_Read_Byte)(const struct IIC_Type*,uint8_t); //IIC_Send_Byte,入口参数为是否要发送ACK信号
void (*delay_us)(uint32_t); //us延时
}IIC_TypeDef;
iic.c源文件主要是类模板具体操作函数的实现,具体如下:
//设置SDA为输入模式
static void SDA_IN(const struct IIC_Type* IIC_Type_t)
{
uint8_t io_num = 0; //定义io Num号
switch(IIC_Type_t->GPIO_SDA)
{
case GPIO_PIN_0:
io_num = 0;
break;
case GPIO_PIN_1:
io_num = 1;
break;
case GPIO_PIN_2:
io_num = 2;
break;
case GPIO_PIN_3:
io_num = 3;
break;
case GPIO_PIN_4:
io_num = 4;
break;
case GPIO_PIN_5:
io_num = 5;
break;
case GPIO_PIN_6:
io_num = 6;
break;
case GPIO_PIN_7:
io_num = 7;
break;
case GPIO_PIN_8:
io_num = 8;
break;
case GPIO_PIN_9:
io_num = 9;
break;
case GPIO_PIN_10:
io_num = 10;
break;
case GPIO_PIN_11:
io_num = 11;
break;
case GPIO_PIN_12:
io_num = 12;
break;
case GPIO_PIN_13:
io_num = 13;
break;
case GPIO_PIN_14:
io_num = 14;
break;
case GPIO_PIN_15:
io_num = 15;
break;
}
IIC_Type_t->GPIOx_SDA->MODER&=~(3<<(io_num*2)); //将GPIOx_SDA->GPIO_SDA清零
IIC_Type_t->GPIOx_SDA->MODER|=0<<(io_num*2); //将GPIOx_SDA->GPIO_SDA设置为输入模式
}
//设置SDA为输出模式
static void SDA_OUT(const struct IIC_Type* IIC_Type_t)
{
uint8_t io_num = 0; //定义io Num号
switch(IIC_Type_t->GPIO_SDA)
{
case GPIO_PIN_0:
io_num = 0;
break;
case GPIO_PIN_1:
io_num = 1;
break;
case GPIO_PIN_2:
io_num = 2;
break;
case GPIO_PIN_3:
io_num = 3;
break;
case GPIO_PIN_4:
io_num = 4;
break;
case GPIO_PIN_5:
io_num = 5;
break;
case GPIO_PIN_6:
io_num = 6;
break;
case GPIO_PIN_7:
io_num = 7;
break;
case GPIO_PIN_8:
io_num = 8;
break;
case GPIO_PIN_9:
io_num = 9;
break;
case GPIO_PIN_10:
io_num = 10;
break;
case GPIO_PIN_11:
io_num = 11;
break;
case GPIO_PIN_12:
io_num = 12;
break;
case GPIO_PIN_13:
io_num = 13;
break;
case GPIO_PIN_14:
io_num = 14;
break;
case GPIO_PIN_15:
io_num = 15;
break;
}
IIC_Type_t->GPIOx_SDA->MODER&=~(3<<(io_num*2)); //将GPIOx_SDA->GPIO_SDA清零
IIC_Type_t->GPIOx_SDA->MODER|=1<<(io_num*2); //将GPIOx_SDA->GPIO_SDA设置为输出模式
}
//设置SCL电平
static void IIC_SCL(const struct IIC_Type* IIC_Type_t,int n)
{
if(n == 1)
{
HAL_GPIO_WritePin(IIC_Type_t->GPIOx_SCL,IIC_Type_t->GPIO_SCL,GPIO_PIN_SET); //设置SCL为高电平
}
else{
HAL_GPIO_WritePin(IIC_Type_t->GPIOx_SCL,IIC_Type_t->GPIO_SCL,GPIO_PIN_RESET); //设置SCL为低电平
}
}
//设置SDA电平
static void IIC_SDA(const struct IIC_Type* IIC_Type_t,int n)
{
if(n == 1)
{
HAL_GPIO_WritePin(IIC_Type_t->GPIOx_SDA,IIC_Type_t->GPIO_SDA,GPIO_PIN_SET); //设置SDA为高电平
}
else{
HAL_GPIO_WritePin(IIC_Type_t->GPIOx_SDA,IIC_Type_t->GPIO_SDA,GPIO_PIN_RESET); //设置SDA为低电平
}
}
//读取SDA电平
static uint8_t READ_SDA(const struct IIC_Type* IIC_Type_t)
{
return HAL_GPIO_ReadPin(IIC_Type_t->GPIOx_SDA,IIC_Type_t->GPIO_SDA); //读取SDA电平
}
//IIC初始化
static void IIC_Init_t(const struct IIC_Type* IIC_Type_t)
{
GPIO_InitTypeDef GPIO_Initure;
//根据GPIO组初始化GPIO时钟
if(IIC_Type_t->GPIOx_SCL == GPIOA || IIC_Type_t->GPIOx_SDA == GPIOA)
{
__HAL_RCC_GPIOA_CLK_ENABLE(); //使能GPIOA时钟
}
if(IIC_Type_t->GPIOx_SCL == GPIOB || IIC_Type_t->GPIOx_SDA == GPIOB)
{
__HAL_RCC_GPIOB_CLK_ENABLE(); //使能GPIOB时钟
}
if(IIC_Type_t->GPIOx_SCL == GPIOC || IIC_Type_t->GPIOx_SDA == GPIOC)
{
__HAL_RCC_GPIOC_CLK_ENABLE(); //使能GPIOC时钟
}
if(IIC_Type_t->GPIOx_SCL == GPIOD || IIC_Type_t->GPIOx_SDA == GPIOD)
{
__HAL_RCC_GPIOD_CLK_ENABLE(); //使能GPIOD时钟
}
if(IIC_Type_t->GPIOx_SCL == GPIOE || IIC_Type_t->GPIOx_SDA == GPIOE)
{
__HAL_RCC_GPIOE_CLK_ENABLE(); //使能GPIOE时钟
}
if(IIC_Type_t->GPIOx_SCL == GPIOH || IIC_Type_t->GPIOx_SDA == GPIOH)
{
__HAL_RCC_GPIOH_CLK_ENABLE(); //使能GPIOH时钟
}
//GPIO_SCL初始化设置
GPIO_Initure.Pin=IIC_Type_t->GPIO_SCL;
GPIO_Initure.Mode=GPIO_MODE_OUTPUT_PP; //推挽输出
GPIO_Initure.Pull=GPIO_PULLUP; //上拉
GPIO_Initure.Speed=GPIO_SPEED_FREQ_VERY_HIGH; //快速
HAL_GPIO_Init(IIC_Type_t->GPIOx_SCL,&GPIO_Initure);
//GPIO_SDA初始化设置
GPIO_Initure.Pin=IIC_Type_t->GPIO_SDA;
GPIO_Initure.Mode=GPIO_MODE_OUTPUT_PP; //推挽输出
GPIO_Initure.Pull=GPIO_PULLUP; //上拉
GPIO_Initure.Speed=GPIO_SPEED_FREQ_VERY_HIGH; //快速
HAL_GPIO_Init(IIC_Type_t->GPIOx_SDA,&GPIO_Initure);
//SCL与SDA的初始化均为高电平
IIC_SCL(IIC_Type_t,1);
IIC_SDA(IIC_Type_t,1);
}
//IIC Start
static void IIC_Start_t(const struct IIC_Type* IIC_Type_t)
{
SDA_OUT(IIC_Type_t); //sda线输出
IIC_SDA(IIC_Type_t,1);
IIC_SCL(IIC_Type_t,1);
IIC_Type_t->delay_us(4);
IIC_SDA(IIC_Type_t,0); //START:when CLK is high,DATA change form high to low
IIC_Type_t->delay_us(4);
IIC_SCL(IIC_Type_t,0); //钳住I2C总线,准备发送或接收数据
}
//IIC Stop
static void IIC_Stop_t(const struct IIC_Type* IIC_Type_t)
{
SDA_OUT(IIC_Type_t); //sda线输出
IIC_SCL(IIC_Type_t,0);
IIC_SDA(IIC_Type_t,0); //STOP:when CLK is high DATA change form low to high
IIC_Type_t->delay_us(4);
IIC_SCL(IIC_Type_t,1);
IIC_SDA(IIC_Type_t,1); //发送I2C总线结束信号
IIC_Type_t->delay_us(4);
}
//IIC_Wait_ack 返回HAL_OK表示wait成功,返回HAL_ERROR表示wait失败
static uint8_t IIC_Wait_Ack_t(const struct IIC_Type* IIC_Type_t) //IIC_Wait_ack,返回wait失败或是成功
{
uint8_t ucErrTime = 0;
SDA_IN(IIC_Type_t); //SDA设置为输入
IIC_SDA(IIC_Type_t,1);IIC_Type_t->delay_us(1);
IIC_SCL(IIC_Type_t,1);IIC_Type_t->delay_us(1);
while(READ_SDA(IIC_Type_t))
{
ucErrTime++;
if(ucErrTime>250)
{
IIC_Type_t->IIC_Stop(IIC_Type_t);
return HAL_ERROR;
}
}
IIC_SCL(IIC_Type_t,0);//时钟输出0
return HAL_OK;
}
//产生ACK应答
static void IIC_Ack_t(const struct IIC_Type* IIC_Type_t)
{
IIC_SCL(IIC_Type_t,0);
SDA_OUT(IIC_Type_t);
IIC_SDA(IIC_Type_t,0);
IIC_Type_t->delay_us(2);
IIC_SCL(IIC_Type_t,1);
IIC_Type_t->delay_us(2);
IIC_SCL(IIC_Type_t,0);
}
//产生NACK应答
static void IIC_NAck_t(const struct IIC_Type* IIC_Type_t)
{
IIC_SCL(IIC_Type_t,0);
SDA_OUT(IIC_Type_t);
IIC_SDA(IIC_Type_t,1);
IIC_Type_t->delay_us(2);
IIC_SCL(IIC_Type_t,1);
IIC_Type_t->delay_us(2);
IIC_SCL(IIC_Type_t,0);
}
//IIC_Send_Byte,入口参数为要发送的字节
static void IIC_Send_Byte_t(const struct IIC_Type* IIC_Type_t,uint8_t txd)
{
uint8_t t = 0;
SDA_OUT(IIC_Type_t);
IIC_SCL(IIC_Type_t,0);//拉低时钟开始数据传输
for(t=0;t<8;t++)
{
IIC_SDA(IIC_Type_t,(txd&0x80)>>7);
txd <<= 1;
IIC_Type_t->delay_us(2); //对TEA5767这三个延时都是必须的
IIC_SCL(IIC_Type_t,1);
IIC_Type_t->delay_us(2);
IIC_SCL(IIC_Type_t,0);
IIC_Type_t->delay_us(2);
}
}
//IIC_Send_Byte,入口参数为是否要发送ACK信号
static uint8_t IIC_Read_Byte_t(const struct IIC_Type* IIC_Type_t,uint8_t ack)
{
uint8_t i,receive = 0;
SDA_IN(IIC_Type_t);//SDA设置为输入
for(i=0;i<8;i++ )
{
IIC_SCL(IIC_Type_t,0);
IIC_Type_t->delay_us(2);
IIC_SCL(IIC_Type_t,1);
receive<<=1;
if(READ_SDA(IIC_Type_t))receive++;
IIC_Type_t->delay_us(1);
}
if (!ack)
IIC_Type_t->IIC_NAck(IIC_Type_t);//发送nACK
else
IIC_Type_t->IIC_Ack(IIC_Type_t); //发送ACK
return receive;
}
//实例化一个IIC1外设,相当于一个结构体变量,可以直接在其他文件中使用
IIC_TypeDef IIC1 = {
.GPIOx_SCL = GPIOA, //GPIO组为GPIOA
.GPIOx_SDA = GPIOA, //GPIO组为GPIOA
.GPIO_SCL = GPIO_PIN_5, //GPIO为PIN5
.GPIO_SDA = GPIO_PIN_6, //GPIO为PIN6
.IIC_Init = IIC_Init_t,
.IIC_Start = IIC_Start_t,
.IIC_Stop = IIC_Stop_t,
.IIC_Wait_Ack = IIC_Wait_Ack_t,
.IIC_Ack = IIC_Ack_t,
.IIC_NAck = IIC_NAck_t,
.IIC_Send_Byte = IIC_Send_Byte_t,
.IIC_Read_Byte = IIC_Read_Byte_t,
.delay_us = delay_us //需自己外部实现delay_us函数
};
上述就是IIC驱动的封装,由于没有应用场景暂不测试其实用性,待下面ATC64的驱动缝缝扎黄写完之后一起测试使用。
// 以下是共定义个具体容量存储器的容量
//定义AT24CXX类
typedef struct AT24CXX_Type
{
//属性
u32 EEP_TYPE; //存储器类型(存储器容量)
//操作
IIC_TypeDef IIC; //IIC驱动
uint8_t (*AT24CXX_ReadOneByte)(const struct AT24CXX_Type*,uint16_t); //指定地址读取一个字节
void (*AT24CXX_WriteOneByte)(const struct AT24CXX_Type*,uint16_t,uint8_t); //指定地址写入一个字节
void (*AT24CXX_WriteLenByte)(uint16_t,uint32_t,uint8_t); //指定地址开始写入指定长度的数据
uint32_t (*AT24CXX_ReadLenByte)(uint16_t,uint8_t); //指定地址开始读取指定长度数据
void (*AT24CXX_Write)(uint16_t,uint8_t *,uint16_t); //指定地址开始写入指定长度的数据
void (*AT24CXX_Read)(uint16_t,uint8_t *,uint16_t); //指定地址开始写入指定长度的数据
void (*AT24CXX_Init)(const struct AT24CXX_Type*); //初始化IIC
uint8_t (*AT24CXX_Check)(const struct AT24CXX_Type*); //检查器件
}AT24CXX_TypeDef;
extern AT24CXX_TypeDef AT24C_64; //外部声明实例化AT24CXX对象
at24cxx.c源文件主要是类模板具体操作函数的实现,具体如下:
//在AT24CXX指定地址读出一个数据
//ReadAddr:开始读数的地址
//返回值 :读到的数据
static uint8_t AT24CXX_ReadOneByte_t(const struct AT24CXX_Type* AT24CXX_Type_t,uint16_t ReadAddr)
{
uint8_t temp=0;
AT24CXX_Type_t->IIC.IIC_Start(&AT24CXX_Type_t->IIC);
//根据AT的型号发送不同的地址
if(AT24CXX_Type_t->EEP_TYPE > AT24C16)
{
AT24CXX_Type_t->IIC.IIC_Send_Byte(&AT24CXX_Type_t->IIC,0XA0); //发送写命令
AT24CXX_Type_t->IIC.IIC_Wait_Ack(&AT24CXX_Type_t->IIC);
AT24CXX_Type_t->IIC.IIC_Send_Byte(&AT24CXX_Type_t->IIC,ReadAddr>>8);//发送高地址
}else AT24CXX_Type_t->IIC.IIC_Send_Byte(&AT24CXX_Type_t->IIC,0XA0+((ReadAddr/256)<<1)); //发送器件地址0XA0,写数据
AT24CXX_Type_t->IIC.IIC_Wait_Ack(&AT24CXX_Type_t->IIC);
AT24CXX_Type_t->IIC.IIC_Send_Byte(&AT24CXX_Type_t->IIC,ReadAddr%256); //发送低地址
AT24CXX_Type_t->IIC.IIC_Wait_Ack(&AT24CXX_Type_t->IIC);
AT24CXX_Type_t->IIC.IIC_Start(&AT24CXX_Type_t->IIC);
AT24CXX_Type_t->IIC.IIC_Send_Byte(&AT24CXX_Type_t->IIC,0XA1); //进入接收模式
AT24CXX_Type_t->IIC.IIC_Wait_Ack(&AT24CXX_Type_t->IIC);
temp=AT24CXX_Type_t->IIC.IIC_Read_Byte(&AT24CXX_Type_t->IIC,0);
AT24CXX_Type_t->IIC.IIC_Stop(&AT24CXX_Type_t->IIC);//产生一个停止条件
return temp;
}
//在AT24CXX指定地址写入一个数据
//WriteAddr :写入数据的目的地址
//DataToWrite:要写入的数据
static void AT24CXX_WriteOneByte_t(const struct AT24CXX_Type* AT24CXX_Type_t,uint16_t WriteAddr,uint8_t DataToWrite)
{
AT24CXX_Type_t->IIC.IIC_Start(&AT24CXX_Type_t->IIC);
if(AT24CXX_Type_t->EEP_TYPE > AT24C16)
{
AT24CXX_Type_t->IIC.IIC_Send_Byte(&AT24CXX_Type_t->IIC,0XA0); //发送写命令
AT24CXX_Type_t->IIC.IIC_Wait_Ack(&AT24CXX_Type_t->IIC);
AT24CXX_Type_t->IIC.IIC_Send_Byte(&AT24CXX_Type_t->IIC,WriteAddr>>8);//发送高地址
}else AT24CXX_Type_t->IIC.IIC_Send_Byte(&AT24CXX_Type_t->IIC,0XA0+((WriteAddr/256)<<1)); //发送器件地址0XA0,写数据
AT24CXX_Type_t->IIC.IIC_Wait_Ack(&AT24CXX_Type_t->IIC);
AT24CXX_Type_t->IIC.IIC_Send_Byte(&AT24CXX_Type_t->IIC,WriteAddr%256); //发送低地址
AT24CXX_Type_t->IIC.IIC_Wait_Ack(&AT24CXX_Type_t->IIC);
AT24CXX_Type_t->IIC.IIC_Send_Byte(&AT24CXX_Type_t->IIC,DataToWrite); //发送字节
AT24CXX_Type_t->IIC.IIC_Wait_Ack(&AT24CXX_Type_t->IIC);
AT24CXX_Type_t->IIC.IIC_Stop(&AT24CXX_Type_t->IIC);//产生一个停止条件
AT24CXX_Type_t->IIC.delay_us(10000);
}
//在AT24CXX里面的指定地址开始写入长度为Len的数据
//该函数用于写入16bit或者32bit的数据.
//WriteAddr :开始写入的地址
//DataToWrite:数据数组首地址
//Len :要写入数据的长度2,4
static void AT24CXX_WriteLenByte_t(uint16_t WriteAddr,uint32_t DataToWrite,uint8_t Len)
{
uint8_t t;
for(t=0;t
{
AT24CXX_WriteOneByte(WriteAddr+t,(DataToWrite>>(8*t))&0xff);
}
}
//在AT24CXX里面的指定地址开始读出长度为Len的数据
//该函数用于读出16bit或者32bit的数据.
//ReadAddr :开始读出的地址
//返回值 :数据
//Len :要读出数据的长度2,4
static uint32_t AT24CXX_ReadLenByte_t(uint16_t ReadAddr,uint8_t Len)
{
uint8_t t;
uint32_t temp=0;
for(t=0;t
{
temp<<=8;
temp+=AT24CXX_ReadOneByte(ReadAddr+Len-t-1);
}
return temp;
}
//在AT24CXX里面的指定地址开始写入指定个数的数据
//WriteAddr :开始写入的地址 对24c64为0~8191
//pBuffer :数据数组首地址
//NumToWrite:要写入数据的个数
static void AT24CXX_Write_t(uint16_t WriteAddr,uint8_t *pBuffer,uint16_t NumToWrite)
{
while(NumToWrite--)
{
AT24CXX_WriteOneByte(WriteAddr,*pBuffer);
WriteAddr++;
pBuffer++;
}
}
//在AT24CXX里面的指定地址开始读出指定个数的数据
//ReadAddr :开始读出的地址 对24c64为0~8191
//pBuffer :数据数组首地址
//NumToRead:要读出数据的个数
static void AT24CXX_Read_t(uint16_t ReadAddr,uint8_t *pBuffer,uint16_t NumToRead)
{
while(NumToRead)
{
*pBuffer++=AT24CXX_ReadOneByte(ReadAddr++);
NumToRead--;
}
}
//初始化IIC接口
static void AT24CXX_Init_t(const struct AT24CXX_Type* AT24CXX_Type_t)
{
AT24CXX_Type_t->IIC.IIC_Init(&AT24CXX_Type_t->IIC);//IIC初始化
}
//检查器件,返回0表示检测成功,返回1表示检测失败
static uint8_t AT24CXX_Check_t(const struct AT24CXX_Type* AT24CXX_Type_t)
{
uint8_t temp;
temp = AT24CXX_Type_t->AT24CXX_ReadOneByte(AT24CXX_Type_t,AT24CXX_Type_t->EEP_TYPE);//避免每次开机都写AT24CXX
if(temp == 0X33)return 0;
else//排除第一次初始化的情况
{
AT24CXX_Type_t->AT24CXX_WriteOneByte(AT24CXX_Type_t,AT24CXX_Type_t->EEP_TYPE,0X33);
temp = AT24CXX_Type_t->AT24CXX_ReadOneByte(AT24CXX_Type_t,AT24CXX_Type_t->EEP_TYPE);
if(temp==0X33)return 0;
}
return 1;
}
//实例化AT24CXX对象
AT24CXX_TypeDef AT24C_64={
.EEP_TYPE = AT24C64, //存储器类型(存储器容量)
//操作
.IIC={
.GPIOx_SCL = GPIOA,
.GPIOx_SDA = GPIOA,
.GPIO_SCL = GPIO_PIN_5,
.GPIO_SDA = GPIO_PIN_6,
.IIC_Init = IIC_Init_t,
.IIC_Start = IIC_Start_t,
.IIC_Stop = IIC_Stop_t,
.IIC_Wait_Ack = IIC_Wait_Ack_t,
.IIC_Ack = IIC_Ack_t,
.IIC_NAck = IIC_NAck_t,
.IIC_Send_Byte = IIC_Send_Byte_t,
.IIC_Read_Byte = IIC_Read_Byte_t,
.delay_us = delay_us
}, //IIC驱动
.AT24CXX_ReadOneByte = AT24CXX_ReadOneByte_t, //指定地址读取一个字节
.AT24CXX_WriteOneByte = AT24CXX_WriteOneByte_t,//指定地址写入一个字节
.AT24CXX_WriteLenByte = AT24CXX_WriteLenByte_t, //指定地址开始写入指定长度的数据
.AT24CXX_ReadLenByte = AT24CXX_ReadLenByte_t, //指定地址开始读取指定长度数据
.AT24CXX_Write = AT24CXX_Write_t, //指定地址开始写入指定长度的数据
.AT24CXX_Read = AT24CXX_Read_t, //指定地址开始读取指定长度的数据
.AT24CXX_Init = AT24CXX_Init_t, //初始化IIC
.AT24CXX_Check = AT24CXX_Check_t //检查器件
};
简单分析:可以看出AT24CXX类中包含了IIC类的成员对象,这是一种包含关系,因为没有属性上的一致性因此谈不上继承。之所以将IIC的类对象作为AT24CXX类的成员是因为AT24CXX的实现需要调用IIC的成员方法,IIC相当于AT24CXX更下层的驱动,因此采用包含关系更合适。因此我们在使用AT24CXX的时候只需要实例化AT24CXX类对象就行了,因为IIC包含在AT24CXX类中间,因此不需要实例化IIC类对象,对外提供了较好的封装接口。下面我们看具体的调用方法。
int main(void)
{
/************省略其他初始化工作****************/
//第一步:调用对象初始化方法来初始化AT24C64
AT24C_64.AT24CXX_Init(&AT24C_64);
//第二步:调用对象检测方法来检测AT24C64
if(AT24C_64.AT24CXX_Check(&AT24C_64) == 0)
{
printf("AT24C64检测成功
");
}
else{
printf("AT24C64检测失败
");
}
return 0;
}
可以看出所有的操作都是通过AT24C_64对象调用完成的,在我们初始化好AT24C_64对象之后就可以放心大胆的调用其成员方法,这样封装的好处就是一个设备对外只提供一个对象接口,简洁明了。全部0条评论
快来发表一下你的评论吧 !