110VCGQ/project/110VCGQV6/user/Inc/AT24C16.h
2024-11-18 10:09:39 +08:00

24 lines
810 B
C
Raw Permalink 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.

/*
* 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_ */