/** \file
 *  \brief This file contains the public interface to the external EEPROM.
 *
 *  On the 2020TPC, the external EEPROM is the Onsemi [CAT24C256](https://www.onsemi.com/pdf/datasheet/cat24c256-d.pdf).
 *
 */

#ifndef NVM_EXTERNALEEPROM_H
#define NVM_EXTERNALEEPROM_H

#ifdef __cplusplus
extern "C" {
#endif

/* Preprocessor and Type Definitions */

#define NVM_EXTERNAL_EEPROM_TASK_STACK_SIZE_in_bytes   256

//! The time between calls to NVM_ExternalEEPROMTask().
#define NVM_EXTERNAL_EEPROM_TASK_RATE_IN_ms 2000

/* Include Files */

/* Public Variables */

extern SemaphoreHandle_t xSemaphoreExternalEEPROMLock;

//! Handle of the NVM_ExternalEEPROMTask() given when the task was created.
extern TaskHandle_t NVM_ExternalEEPROM_Task_Handle;

extern volatile bool NVM_IsExternalEEPROMInitialized;

/* Public Functions */
void NVM_InitExternalEEPROM(void);
void NVM_ExternalEEPROMTask(void * pvParameters);
void NVM_SaveExternalEEPROMEntry(NVM_EEPROMEntry_T * const this);

/* Inline Functions */

#ifdef __cplusplus
}
#endif

#endif // NVM_EXTERNALEEPROM_H
