#ifndef __INT_EEPROM_H #define __INT_EEPROM_H #include "main.h" /* BL24C16F:16Kbit = 2048 字节 */ #define INT_EEPROM_SIZE 2048 /* 容量(字节) */ #define INT_EEPROM_PAGE_SIZE 16 /* 页大小(字节) */ #define INT_EEPROM_PAGES 128 /* 页数 */ /* I2C 设备地址(7 位,A0/A1/A2 接地) */ #define INT_EEPROM_ADDR 0x50 /* 初始化 I2C2 并检测芯片应答;返回 0 表示成功 */ uint8_t Int_eeprom_init(void); /* 任意地址读取 datalen 字节(支持跨页,I2C 顺序读无页限制) */ uint8_t Int_eeprom_read(uint8_t *pbuf, uint16_t addr, uint16_t datalen); /* 任意地址写入 datalen 字节,自动按页拆分,写入后等待写入周期完成 */ uint8_t Int_eeprom_write(uint8_t *pbuf, uint16_t addr, uint16_t datalen); /* 擦除整片(所有地址写 0xFF) */ uint8_t Int_eeprom_erase_chip(void); #endif