#ifndef INT_EEPROM24XX_H
#define INT_EEPROM24XX_H

#include <stdint.h>
#include "stm32f4xx_hal.h"

#define INT_EEPROM_OK 0
#define INT_EEPROM_ERR_ARG -1
#define INT_EEPROM_ERR_IO -2
#define INT_EEPROM_ERR_NOT_INIT -3
#define INT_EEPROM_ERR_RANGE -4

/* Compile-time configuration for M24C64 on this board. */
#define INT_EEPROM24XX_DEV_ADDR (0x50u << 1)
#define INT_EEPROM24XX_I2C_HANDLE hi2c2
#define INT_EEPROM24XX_PAGE_SIZE 32u
#define INT_EEPROM24XX_MEM_ADDR_SIZE 2u
#define INT_EEPROM24XX_MEM_SIZE_BYTES 8192u
#define INT_EEPROM24XX_WRITE_CYCLE_MS 20u
#define INT_EEPROM24XX_TIMEOUT_MS 100u

int32_t Int_EEPROM24xx_Init(void);
int32_t Int_EEPROM24xx_Read(uint32_t mem_addr, uint8_t *buf, uint16_t len);
int32_t Int_EEPROM24xx_Write(uint32_t mem_addr, const uint8_t *buf, uint16_t len);
uint32_t Int_EEPROM24xx_GetLastHalError(void);

#endif
