/*
 * EEPROM_M24C64.h
 *
 * Created: Fri Dec 24 2021 12:23:59
 *  Author Chris
 */
#ifndef EEPROM_M24C64_H_
#define EEPROM_M24C64_H_

// ============================================================================================
// Includes
#include <stdint.h>
#include <stdbool.h>

#include "pico/types.h"
#include "pico/stdlib.h"
#include "pico/binary_info.h"

#include "Command_Definition.h"


// ============================================================================================
// Defines
#define EEPROM_STATUS_NONE				0
#define EEPROM_STATUS_WRITE_OK			1
#define EEPROM_STATUS_WRITE_FAILED		2


// ============================================================================================
// Datatypes

typedef struct {
	int32_t Idle_Screen;
	int32_t Screen_Timeout;
	uint8_t Reverse_List_Scrolling;
	uint8_t	Use_Color_Correction;
    int32_t Current_Threshold;
} __packed Device_Configuration_s;

typedef struct 
{
	Channel_MIDI_Configuration_s 	Channel_MIDI_Configuration[NUM_LED_CHANNELS];
	Pause_Light_Configuration_s		Pause_Light_Configuration[NUM_LED_CHANNELS];
	Jam_Light_Configuration_s		Jam_Light_Configuration;
	Const_Light_Configuration_s		Const_Light_Configuration;
	Device_Configuration_s			Device_Configuration;
} __packed EEPROM_Content_t;

extern volatile EEPROM_Content_t _EEPROM_Content;


// ============================================================================================
// Function Declarations
void 	EEPROM_Init();
void 	EEPROM_Tick();

void 	EEPROM_Trigger_Update();
uint8_t EEPROM_Get_Write_Status();
uint	EEPROM_Get_Content_Size();
uint	EEPROM_Get_Read_Write_Steps();


#endif /* EEPROM_M24C64_H_ */
