EEPROM emulation using Flash for STM32F103

Dependents:   F103-Web-Server

Revision:
0:ea2bec485611
Child:
1:e593ae8ff81d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eeprom_flash.h	Sat Aug 13 22:44:48 2016 +0000
@@ -0,0 +1,19 @@
+#ifndef __EEPROM_FLASH_H
+#define __EEPROM_FLASH_H
+
+#include "mbed.h"
+
+#define EEPROM_START_ADDRESS   ((uint32_t)0x08019000) // EEPROM emulation start address: after 100KByte of used Flash memory
+
+void enableEEPROMWriting(); // Unlock and keep PER cleared
+void disableEEPROMWriting(); // Lock
+
+// Write functions
+HAL_StatusTypeDef writeEEPROMHalfWord(uint32_t address, uint16_t data);
+HAL_StatusTypeDef writeEEPROMWord(uint32_t address, uint32_t data);
+
+// Read functions
+uint16_t readEEPROMHalfWord(uint32_t address);
+uint32_t readEEPROMWord(uint32_t address);
+
+#endif
\ No newline at end of file