EEPROM emulation using Flash for STM32F103

Dependents:   F103-Web-Server

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers eeprom_flash.h Source File

eeprom_flash.h

00001 #ifndef __EEPROM_FLASH_H
00002 #define __EEPROM_FLASH_H
00003 
00004 #include "mbed.h"
00005 
00006 //#define EEPROM_START_ADDRESS   ((uint32_t)0x08019000) // EEPROM emulation start address: after 100KByte of used Flash memory
00007 #define EEPROM_START_ADDRESS   ((uint32_t)0x0801C000) // EEPROM emulation start address: after 112KByte of used Flash memory
00008 
00009 void enableEEPROMWriting(); // Unlock and keep PER cleared
00010 void disableEEPROMWriting(); // Lock
00011 
00012 // Write functions
00013 HAL_StatusTypeDef writeEEPROMHalfWord(uint32_t address, uint16_t data);
00014 HAL_StatusTypeDef writeEEPROMWord(uint32_t address, uint32_t data);
00015 
00016 // Read functions
00017 uint16_t readEEPROMHalfWord(uint32_t address);
00018 uint32_t readEEPROMWord(uint32_t address);
00019 
00020 #endif