/* * AT24C16.h * * Created on: Sep 26, 2024 * Author: 10425 */ #ifndef INC_AT24C16_H_ #define INC_AT24C16_H_ #define AT24C16_ADDR 0x50 // AT24C16 的器件地址,默认0x50,根据A2,A1,A0硬件引脚配置变化 #define AT24C16_PAGE_SIZE 16 // 每页大小为16字节 #define AT24C16_TOTAL_SIZE 2048 // 总容量 16Kb = 2048 字节 #define I2C_HANDLE hi2c2 #define AT24C16_TIMEOUT 10 HAL_StatusTypeDef AT24C16_WriteByte(uint16_t mem_address, uint8_t data); HAL_StatusTypeDef AT24C16_ReadByte(uint16_t mem_address, uint8_t *data); HAL_StatusTypeDef AT24C16_WriteBytes(uint16_t mem_address, uint8_t *data, uint16_t size); HAL_StatusTypeDef AT24C16_ReadBytes(uint16_t mem_address, uint8_t *data, uint16_t size); HAL_StatusTypeDef AT24C16_Init(void); #endif /* INC_AT24C16_H_ */