Make EEPROM transfers receive an operation and a buffer id parameter. This allows reading and writing both staging and validated user configurations which will aid future debugging. This API is also cleaner.

This commit is contained in:
László Monda
2017-10-05 02:45:22 +02:00
parent 259f4d3299
commit 377fe4a2b2
6 changed files with 67 additions and 39 deletions

View File

@@ -1,9 +1,16 @@
#ifndef __EEPROM_H__
#define __EEPROM_H__
// Includes:
#include "config_parser/config_globals.h"
// Macros:
#define EEPROM_SIZE (32*1024)
#define HARDWARE_CONFIG_SIZE 64
#define USER_CONFIG_SIZE (EEPROM_SIZE - HARDWARE_CONFIG_SIZE)
#define EEPROM_ADDRESS_LENGTH 2
#define EEPROM_PAGE_SIZE 64
#define EEPROM_BUFFER_SIZE (EEPROM_ADDRESS_LENGTH + EEPROM_PAGE_SIZE)
@@ -11,21 +18,18 @@
// Typedefs:
typedef enum {
EepromTransfer_ReadHardwareConfiguration,
EepromTransfer_WriteHardwareConfiguration,
EepromTransfer_ReadUserConfiguration,
EepromTransfer_WriteUserConfiguration,
} eeprom_transfer_t;
EepromOperation_Read,
EepromOperation_Write,
} eeprom_operation_t;
// Variables:
extern bool IsEepromBusy;
extern eeprom_transfer_t CurrentEepromTransfer;
extern status_t EepromTransferStatus;
// Functions:
void EEPROM_Init(void);
status_t EEPROM_LaunchTransfer(eeprom_transfer_t transferType, void (*successCallback));
status_t EEPROM_LaunchTransfer(eeprom_operation_t operation, config_buffer_id_t config_buffer_id, void (*successCallback));
#endif