/*
 * Eeprom.h
 *
 *  Created on: Jun 26, 2024
 *      Author: remy.cluze
 */

#ifndef INC_EEPROM_H_
#define INC_EEPROM_H_

// Adresse de l'EEPROM (à ajuster selon la configuration de votre matériel)
#define EEPROM_ADDRESS 0xA0

#define ADD_Parcours 	0x0000
#define ADD_ENREGISTRE	ADD_Parcours + sizeof(uint16_t)
#define ADD_VitessMax 	ADD_ENREGISTRE + sizeof(uint16_t)
#define ADD_Denivle		ADD_VitessMax + sizeof(float)
#define ADD_AltMax		ADD_Denivle + sizeof(float)
#define ADD_TempMin		ADD_AltMax + sizeof(float)
#define ADD_TempMax		ADD_TempMin + sizeof(float)
#define STARTADD_PAR 	ADD_TempMax  + sizeof(float)
#define STARTADD_ENR	STARTADD_PAR + sizeof(float)*100*2

void EEPROM_WriteEnable(void);

void EEPROM_WriteDisable(void);

HAL_StatusTypeDef EEPROM_WriteByte(uint16_t addr, uint8_t data);

HAL_StatusTypeDef EEPROM_ReadByte(uint16_t addr, uint8_t *data);

HAL_StatusTypeDef EEPROM_WritePage(uint16_t addr, uint8_t *data, uint8_t length);

HAL_StatusTypeDef EEPROM_ReadPage(uint16_t addr, uint8_t *data, uint8_t length);

HAL_StatusTypeDef EEPROM_WriteUInt16(uint16_t addr, uint16_t data);

HAL_StatusTypeDef EEPROM_ReadUInt16(uint16_t addr, uint16_t *data);

HAL_StatusTypeDef EEPROM_WriteFloat(uint16_t addr, float data);

HAL_StatusTypeDef EEPROM_ReadFloat(uint16_t addr, float *data);

#endif /* INC_EEPROM_H_ */
