Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
### Releases v1.0.1

1. Fix compiler warnings.
  • Loading branch information
khoih-prog committed Feb 23, 2021
1 parent 2d617bf commit f3912b5
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 45 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p

Please ensure to specify the following:

* Arduino IDE version (e.g. 1.8.10) or Platform.io version
* `ESP8266` or `ESP32` Core Version (e.g. ESP8266 core v2.6.3 or ESP32 v1.0.4)
* Arduino IDE version (e.g. 1.8.13) or Platform.io version
* Board Core Version (e.g. Arduino STM32 core v1.9.0, etc.)
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
* Anything that might be relevant in your opinion, such as:
Expand All @@ -27,7 +27,7 @@ Please ensure to specify the following:

```
Arduino IDE version: 1.8.13
STM32 Core Version 1.9.0
Arduino STM32 core v1.9.0
OS: Ubuntu 20.04 LTS
Linux Inspiron-3593 5.4.0-64-generic #72-Ubuntu SMP Fri Jan 15 10:27:54 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Expand Down
41 changes: 38 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* [Features](#features)
* [Currently supported Boards](#currently-supported-boards)
* [Changelog](#changelog)
* [Releases v1.0.1](#releases-v101)
* [Releases v1.0.0](#releases-v100)
* [Prerequisites](#prerequisites)
* [Installation](#installation)
Expand All @@ -36,6 +37,10 @@
* [ 9. **EmulateEEPROM**](examples/EmulateEEPROM)
* [ 10. **FlashStoreAndRetrieve**](examples/FlashStoreAndRetrieve)
* [ 11. **StoreNameAndSurname**](examples/StoreNameAndSurname)
* [Examples from other libraries](#examples-from-other-libraries)
* [ 1. Library WiFiManager_Generic_Lite](#1-library-wifimanager_generic_lite)
* [ 2. Library WiFiManager_NINA_Lite](#2-library-wifimanager_nina_lite)
* [ 3. Library Ethernet_Manager_STM32](#3-library-ethernet_manager_stm32)
* [Example StoreNameAndSurname](#example-storenameandsurname)
* [FAQ](#faq)
* [Can I use a single object to store more stuff?](#can-i-use-a-single-object-to-store-more-stuff)
Expand All @@ -58,7 +63,7 @@

### Features

The FlashStorage_STM32 library, inspired from [Cristian Maglie's FlashStorage](https://github.com/cmaglie/FlashStorage), provides a convenient way to store and retrieve user's data using emulated-EEPROM, from the non-volatile flash memory of STM32F/L/H/G/WB/MP1.
The FlashStorage_STM32 library, inspired by [Cristian Maglie's FlashStorage](https://github.com/cmaglie/FlashStorage), provides a convenient way to store and retrieve user's data using emulated-EEPROM, from the non-volatile flash memory of STM32F/L/H/G/WB/MP1.

The flash memory, generally used to store the firmware code, can also be used to store / retrieve more user's data and faster than from EEPROM. Thanks to the **buffered data writing and reading**, the flash access time is greatly reduced to **increase the life of the flash**.

Expand Down Expand Up @@ -86,6 +91,10 @@ The flash memory, generally used to store the firmware code, can also be used to

## Changelog

### Releases v1.0.1

1. Fix compiler warnings.

### Releases v1.0.0

1. Initial release to support STM32F/L/H/G/WB/MP1 board with / without integrated EEPROM
Expand All @@ -97,7 +106,7 @@ The flash memory, generally used to store the firmware code, can also be used to
## Prerequisites

1. [`Arduino IDE 1.8.13+` for Arduino](https://www.arduino.cc/en/Main/Software)
2. [`Arduino Core for STM32 1.9.0+`](https://github.com/stm32duino/Arduino_Core_STM32) for STM32 (Use Arduino Board Manager)
2. [`Arduino Core for STM32 v1.9.0+`](https://github.com/stm32duino/Arduino_Core_STM32) for STM32 boards. [![GitHub release](https://img.shields.io/github/release/stm32duino/Arduino_Core_STM32.svg)](https://github.com/stm32duino/Arduino_Core_STM32/releases/latest)

---

Expand Down Expand Up @@ -170,6 +179,28 @@ The API is very similar to the well known Arduino EEPROM.h API but with 4 additi
10. [FlashStoreAndRetrieve](examples/FlashStoreAndRetrieve)
11. [StoreNameAndSurname](examples/StoreNameAndSurname)


### Examples from other libraries

### 1. Library [WiFiManager_Generic_Lite](https://github.com/khoih-prog/WiFiManager_Generic_Lite)

1. [STM32_WiFi](https://github.com/khoih-prog/WiFiManager_Generic_Lite/tree/main/examples/STM32_WiFi)
2. [STM32_WiFi_MQTT](https://github.com/khoih-prog/WiFiManager_Generic_Lite/tree/main/examples/STM32_WiFi_MQTT)

### 2. Library [WiFiManager_NINA_Lite](https://github.com/khoih-prog/WiFiManager_NINA_Lite)

1. [STM32_WiFiNINA](https://github.com/khoih-prog/WiFiManager_NINA_Lite/tree/main/examples/STM32_WiFiNINA)
2. [STM32_WiFiNINA_MQTT](https://github.com/khoih-prog/WiFiManager_NINA_Lite/tree/main/examples/STM32_WiFiNINA_MQTT)

### 3. Library [Ethernet_Manager_STM32](https://github.com/khoih-prog/Ethernet_Manager_STM32)

1. [AM2315_Ethernet_STM32](https://github.com/khoih-prog/Ethernet_Manager_STM32/tree/main/examples/AM2315_Ethernet_STM32)
2. [DHT11_Ethernet_STM32](https://github.com/khoih-prog/Ethernet_Manager_STM32/tree/main/examples/DHT11_Ethernet_STM32)
3. [Ethernet_STM32](https://github.com/khoih-prog/Ethernet_Manager_STM32/tree/main/examples/Ethernet_STM32)
4. [MQTT_ThingStream_Ethernet_STM32](https://github.com/khoih-prog/Ethernet_Manager_STM32/tree/main/examples/MQTT_ThingStream_Ethernet_STM32)

and mamy more to come.

---
---

Expand Down Expand Up @@ -297,6 +328,10 @@ Sometimes, the library will only work if you update the board core to the latest

## Releases

### Releases v1.0.1

1. Fix compiler warnings.

### Releases v1.0.0

1. Initial release to support STM32F/L/H/G/WB/MP1 board with / without integrated EEPROM
Expand Down Expand Up @@ -377,5 +412,5 @@ If you want to contribute to this project:

### Copyright

Copyright 2020- Khoi Hoang
Copyright 2021- Khoi Hoang

3 changes: 2 additions & 1 deletion examples/EEPROM_CRC/EEPROM_CRC.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_STM32
Licensed under MIT license
Version: 1.0.0
Version: 1.0.1

Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/01/2021 Initial coding to support STM32F/L/H/G/WB/MP1 using emulated-EEPROM
1.0.1 K Hoang 23/02/2021 Fix compiler warnings.
******************************************************************************************************************************************/
/***
Written by Christopher Andrews.
Expand Down
3 changes: 2 additions & 1 deletion examples/EEPROM_Clear/EEPROM_Clear.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_STM32
Licensed under MIT license
Version: 1.0.0
Version: 1.0.1

Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/01/2021 Initial coding to support STM32F/L/H/G/WB/MP1 using emulated-EEPROM
1.0.1 K Hoang 23/02/2021 Fix compiler warnings.
******************************************************************************************************************************************/

#include <FlashStorage_STM32.h>
Expand Down
3 changes: 2 additions & 1 deletion examples/EEPROM_get/EEPROM_get.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_STM32
Licensed under MIT license
Version: 1.0.0
Version: 1.0.1

Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/01/2021 Initial coding to support STM32F/L/H/G/WB/MP1 using emulated-EEPROM
1.0.1 K Hoang 23/02/2021 Fix compiler warnings.
******************************************************************************************************************************************/
/***
eeprom_get example.
Expand Down
3 changes: 2 additions & 1 deletion examples/EEPROM_iteration/EEPROM_iteration.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_STM32
Licensed under MIT license
Version: 1.0.0
Version: 1.0.1

Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/01/2021 Initial coding to support STM32F/L/H/G/WB/MP1 using emulated-EEPROM
1.0.1 K Hoang 23/02/2021 Fix compiler warnings.
******************************************************************************************************************************************/
/***
eeprom_iteration example.
Expand Down
3 changes: 2 additions & 1 deletion examples/EEPROM_put/EEPROM_put.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_STM32
Licensed under MIT license
Version: 1.0.0
Version: 1.0.1

Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/01/2021 Initial coding to support STM32F/L/H/G/WB/MP1 using emulated-EEPROM
1.0.1 K Hoang 23/02/2021 Fix compiler warnings.
******************************************************************************************************************************************/
/***
eeprom_put example.
Expand Down
3 changes: 2 additions & 1 deletion examples/EEPROM_read/EEPROM_read.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_STM32
Licensed under MIT license
Version: 1.0.0
Version: 1.0.1

Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/01/2021 Initial coding to support STM32F/L/H/G/WB/MP1 using emulated-EEPROM
1.0.1 K Hoang 23/02/2021 Fix compiler warnings.
******************************************************************************************************************************************/
/*
EEPROM Read
Expand Down
3 changes: 2 additions & 1 deletion examples/EEPROM_update/EEPROM_update.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_STM32
Licensed under MIT license
Version: 1.0.0
Version: 1.0.1

Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/01/2021 Initial coding to support STM32F/L/H/G/WB/MP1 using emulated-EEPROM
1.0.1 K Hoang 23/02/2021 Fix compiler warnings.
******************************************************************************************************************************************/
/***
EEPROM Update method
Expand Down
3 changes: 2 additions & 1 deletion examples/EEPROM_write/EEPROM_write.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_STM32
Licensed under MIT license
Version: 1.0.0
Version: 1.0.1

Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/01/2021 Initial coding to support STM32F/L/H/G/WB/MP1 using emulated-EEPROM
1.0.1 K Hoang 23/02/2021 Fix compiler warnings.
******************************************************************************************************************************************/
/*
EEPROM Write
Expand Down
3 changes: 2 additions & 1 deletion examples/EmulateEEPROM/EmulateEEPROM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_STM32
Licensed under MIT license
Version: 1.0.0
Version: 1.0.1

Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/01/2021 Initial coding to support STM32F/L/H/G/WB/MP1 using emulated-EEPROM
1.0.1 K Hoang 23/02/2021 Fix compiler warnings.
******************************************************************************************************************************************/

// Demonstrate how to use FlashStorage_STM32 with an API that is similar to the EEPROM library.
Expand Down
3 changes: 2 additions & 1 deletion examples/FlashStoreAndRetrieve/FlashStoreAndRetrieve.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_STM32
Licensed under MIT license
Version: 1.0.0
Version: 1.0.1

Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/01/2021 Initial coding to support STM32F/L/H/G/WB/MP1 using emulated-EEPROM
1.0.1 K Hoang 23/02/2021 Fix compiler warnings.
******************************************************************************************************************************************/

#include <FlashStorage_STM32.h>
Expand Down
3 changes: 2 additions & 1 deletion examples/StoreNameAndSurname/StoreNameAndSurname.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_STM32
Licensed under MIT license
Version: 1.0.0
Version: 1.0.1

Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/01/2021 Initial coding to support STM32F/L/H/G/WB/MP1 using emulated-EEPROM
1.0.1 K Hoang 23/02/2021 Fix compiler warnings.
******************************************************************************************************************************************/

// Demonstrate how to use FlashStorage_STM32 with an API that is similar to the EEPROM library to Store and retrieve structured data.
Expand Down
8 changes: 4 additions & 4 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "FlashStorage_STM32",
"keywords": "storage,data,flash,flashstorage,flash-storage,eeprom,emulated-eeprom",
"version": "1.0.1",
"keywords": "storage, data, flash, flashstorage, flash-storage, eeprom, emulated-eeprom, emulation, stm32, st32f, stm32l, stm32h, stm32g, stm32wb, stm32mp1,ST STM32, bluepill, blackpill, nucleo",
"description": "The FlashStorage_STM32 library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory of STM32F/L/H/G/WB/MP1. It's using the buffered read and write to minimize the access to Flash. It now supports writing and reading the whole object, not just byte-and-byte.",
"repository":
{
"type": "git",
"url": "https://github.com/khoih-prog/FlashStorage_STM32"
},
"version": "1.0.0",
},
"frameworks": "arduino",
"platforms": "stm32"
"platforms": ["ststm32", "stm32"]
}
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name=FlashStorage_STM32
version=1.0.0
version=1.0.1
author=Khoi Hoang
maintainer=Khoi Hoang <khoih.prog@gmail.com>
license=MIT
sentence=The FlashStorage_STM32 library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory of STM32F/L/H/G/WB/MP1. It's using the buffered read and write to minimize the access to Flash. It now supports writing and reading the whole object, not just byte-and-byte.
paragraph=Useful if the EEPROM is not available or too small. Currently, STM32F/L/H/G/WB/MP1 are supported.
url=https://github.com/khoih-prog/FlashStorage_STM32
architectures=stm32
architectures=stm32,ststm32
category=Data Storage
43 changes: 21 additions & 22 deletions src/FlashStorage_STM32.h
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
/*
EEPROM like API that uses Arduino Zero's flash memory.
Written by A. Christian
/******************************************************************************************************************************************
FlashStorage_STM32.h
For STM32 using Flash emulated-EEPROM

Copyright (c) 2015-2016 Arduino LLC. All right reserved.
The FlashStorage_STM32 library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory
of STM32F/L/H/G/WB/MP1. It's using the buffered read and write to minimize the access to Flash.
It now supports writing and reading the whole object, not just byte-and-byte.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
Inspired by Cristian Maglie's FlashStorage (https://github.com/cmaglie/FlashStorage)

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_STM32
Licensed under MIT license
Version: 1.0.1

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/01/2021 Initial coding to support STM32F/L/H/G/WB/MP1 using emulated-EEPROM
1.0.1 K Hoang 23/02/2021 Fix compiler warnings.
******************************************************************************************************************************************/

#pragma once

#ifndef FlashAsEEPROM_STM32_h
#define FlashAsEEPROM_STM32_h
#ifndef FlashStorage_STM32_h
#define FlashStorage_STM32_h

#if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
defined(STM32WB) || defined(STM32MP1) )
#error This code is intended to run on STM32 platform! Please check your Tools->Board setting.
#endif

#define FLASH_STORAGE_STM32_VERSION "FlashStorage_STM32 v1.0.0"
#define FLASH_STORAGE_STM32_VERSION "FlashStorage_STM32 v1.0.1"

// Only use this with emulated EEPROM, without integrated EEPROM
#if !defined(DATA_EEPROM_BASE)
Expand Down Expand Up @@ -134,7 +133,7 @@
}

return t;
}
}

/**
* Check whether the eeprom data is valid
Expand Down Expand Up @@ -178,10 +177,10 @@
_initialized = true;
}

bool _initialized;
bool _validEEPROM;
bool _initialized;
bool _dirtyBuffer;
bool _commitASAP;
bool _validEEPROM;
};

EEPROMClass EEPROM;
Expand Down

0 comments on commit f3912b5

Please sign in to comment.