/*
 * bsp_EEPROM.h
 *
 *  Created on: Oct 26, 2023
 *      Author: shiya
 */

#ifndef INC_BSP_EEPROM_H_
#define INC_BSP_EEPROM_H_

#include "bsp_include.h"

#define EEPROM_WP_Pin GPIO_PIN_11
#define EEPROM_WP_GPIO_Port GPIOE
#define EEPROM_SCL_Pin GPIO_PIN_12
#define EEPROM_SCL_GPIO_Port GPIOE
#define EEPROM_SDA_Pin GPIO_PIN_13
#define EEPROM_SDA_GPIO_Port GPIOE


#define AT24C512
#ifdef AT24C512
	#define EE_MODEL_NAME		"AT24C512"
	#define EE_DEV_ADDR			0xA0		/* 设备地址 */
	#define EE_PAGE_SIZE		128			/* 页面大小(字节) */
	#define EE_SIZE				(512*128)	/* 总容量(字节) */
	#define EE_ADDR_BYTES		2			/* 地址字节个数 */
#endif

#define I2C_WR	0		/* 写控制bit */
#define I2C_RD	1		/* 读控制bit */

//////////////////////////////////////////////////////////////////

//返回值：：1-正常；0-错误
uint8_t GF_BSP_EEPROM_Init(void);

uint8_t GF_BSP_EEPROM_CheckOK(void);
uint8_t GF_BSP_EEPROM_ReadBytes(uint8_t *_pReadBuf, uint16_t _usAddress, uint16_t _usSize);
uint8_t GF_BSP_EEPROM_WriteBytes(uint8_t *_pWriteBuf, uint16_t _usAddress, uint16_t _usSize);


#endif /* INC_BSP_EEPROM_H_ */
