* Global variables shared between an interrupt and the main code should be volatile See: https://www.embedded.com/electronics-blogs/beginner-s-corner/4023801/Introduction-to-the-Volatile-Keyword * There is no reason to change the active report if it has not changed * Declare local functions and variables static This both helps the compiler and the programmer
36 lines
810 B
C
36 lines
810 B
C
#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_SIZE 2
|
|
#define EEPROM_PAGE_SIZE 64
|
|
#define EEPROM_BUFFER_SIZE (EEPROM_ADDRESS_SIZE + EEPROM_PAGE_SIZE)
|
|
|
|
// Typedefs:
|
|
|
|
typedef enum {
|
|
EepromOperation_Read,
|
|
EepromOperation_Write,
|
|
} eeprom_operation_t;
|
|
|
|
// Variables:
|
|
|
|
extern volatile bool IsEepromBusy;
|
|
|
|
// Functions:
|
|
|
|
void EEPROM_Init(void);
|
|
status_t EEPROM_LaunchTransfer(eeprom_operation_t operation, config_buffer_id_t config_buffer_id, void (*successCallback));
|
|
bool IsEepromOperationValid(eeprom_operation_t operation);
|
|
|
|
#endif
|