diff --git a/README.md b/README.md index e760a5e..9151441 100644 --- a/README.md +++ b/README.md @@ -574,7 +574,7 @@ BBBBBBBBB BBBBBBBBBB BBBBBBBBBB BBBBBBBBBB BBBBBBBBBB BBBBBBBBBB BBBBBBBBBB ``` Start StoreNameAndSurname on SEEED_XIAO_M0 -FlashStorage_SAMD v1.3.1 +FlashStorage_SAMD v1.3.2 EEPROM length: 1024 EEPROM is empty, writing WRITTEN_SIGNATURE and some example data: Insert your name : John @@ -589,7 +589,7 @@ You can reset to check emulated-EEPROM data retention. ``` Start StoreNameAndSurname on SEEED_XIAO_M0 -FlashStorage_SAMD v1.3.1 +FlashStorage_SAMD v1.3.2 EEPROM length: 1024 Hi John Doe, nice to see you again :-) Clearing WRITTEN_SIGNATURE for next try @@ -604,7 +604,7 @@ Done clearing signature in emulated EEPROM. You can reset now ``` Start EEPROM_Clear on SEEED_XIAO_M0 -FlashStorage_SAMD v1.3.1 +FlashStorage_SAMD v1.3.2 Emulated EEPROM length (bytes) = 1024 @@ -616,7 +616,7 @@ Done clearing emulated EEPROM. Time spent (ms) = 11 ``` Start EEPROM_Clear on SEEED_XIAO_M0 -FlashStorage_SAMD v1.3.1 +FlashStorage_SAMD v1.3.2 Emulated EEPROM length (bytes) = 2048 Done clearing emulated EEPROM. Time spent (ms) = 22 ``` @@ -625,7 +625,7 @@ Done clearing emulated EEPROM. Time spent (ms) = 22 ``` Start EEPROM_Clear on SEEED_XIAO_M0 -FlashStorage_SAMD v1.3.1 +FlashStorage_SAMD v1.3.2 Emulated EEPROM length (bytes) = 4096 Done clearing emulated EEPROM. Time spent (ms) = 42 ``` @@ -638,7 +638,7 @@ Done clearing emulated EEPROM. Time spent (ms) = 42 ``` Start EEPROM_get on SEEED_XIAO_M0 -FlashStorage_SAMD v1.3.1 +FlashStorage_SAMD v1.3.2 EEPROM length: 1024 EEPROM doesn't store valid data, writing WRITTEN_SIGNATURE and some example data Float written to EEPROM: 123.456 @@ -655,7 +655,7 @@ Reset to see how you can retrieve the values by using EEPROM_get! ``` Start EEPROM_get on SEEED_XIAO_M0 -FlashStorage_SAMD v1.3.1 +FlashStorage_SAMD v1.3.2 EEPROM length: 1024 EEPROM has valid data with WRITTEN_SIGNATURE. Now read some example data Read float from EEPROM: 123.456 @@ -714,16 +714,16 @@ Submit issues to: [FlashStorage_SAMD issues](https://github.com/khoih-prog/Flash ### DONE -1. Basic emulated-EEPROM for SAMD21/SAMD51. -2. Add `EEPROM.put()` and `EEPROM.get()` functions to read/write the whole struct in emulated-EEPROM -3. Similar features for STM32F/L/H/G/WB/MP1. -4. Add Table of Contents -5. Add support to Industruino SAMD21 DG21 and Industruino SAML21 420MAKER boards -6. Add support to **Sparkfun SAMD21 and SAMD51 boards** -7. Fix `multiple-definitions` linker error. -8. Add support to many more boards, such as `SAMD21E1xA`, `SAMD21G1xA` and`SAMD21J1xA` -9. Clean-up by reducing the number of library files - + 1. Basic emulated-EEPROM for SAMD21/SAMD51. + 2. Add `EEPROM.put()` and `EEPROM.get()` functions to read/write the whole struct in emulated-EEPROM + 3. Similar features for STM32F/L/H/G/WB/MP1. + 4. Add Table of Contents + 5. Add support to Industruino SAMD21 DG21 and Industruino SAML21 420MAKER boards + 6. Add support to **Sparkfun SAMD21 and SAMD51 boards** + 7. Fix `multiple-definitions` linker error. + 8. Add support to many more boards, such as `SAMD21E1xA`, `SAMD21G1xA` and`SAMD21J1xA` + 9. Clean-up by reducing the number of library files +10. Make compatible with old libraries and codes --- --- diff --git a/changelog.md b/changelog.md index 636f6a5..a977c61 100644 --- a/changelog.md +++ b/changelog.md @@ -12,6 +12,7 @@ ## Table of Contents * [Changelog](#changelog) + * [Releases v1.3.2](#releases-v132) * [Releases v1.3.1](#releases-v131) * [Releases v1.3.0](#releases-v130) * [Releases v1.2.1](#releases-v121) @@ -25,6 +26,10 @@ ## Changelog +### Releases v1.3.2 + +1. Make compatible with old libraries and codes + ### Releases v1.3.1 1. Clean-up by reducing the number of library files diff --git a/examples/multiFileProject/multiFileProject.ino b/examples/multiFileProject/multiFileProject.ino index 13c9bc3..b2f8426 100644 --- a/examples/multiFileProject/multiFileProject.ino +++ b/examples/multiFileProject/multiFileProject.ino @@ -24,8 +24,8 @@ #error This code is designed to run on SAMD21/SAMD51 platform! Please check your Tools->Board setting. #endif -#define FLASH_STORAGE_SAMD_VERSION_MIN_TARGET "FlashStorage_SAMD v1.3.1" -#define FLASH_STORAGE_SAMD_VERSION_MIN 1003001 +#define FLASH_STORAGE_SAMD_VERSION_MIN_TARGET "FlashStorage_SAMD v1.3.2" +#define FLASH_STORAGE_SAMD_VERSION_MIN 1003002 #include "multiFileProject.h" diff --git a/library.json b/library.json index a20334c..2af3e2f 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "FlashStorage_SAMD", - "version": "1.3.1", + "version": "1.3.2", "keywords": "storage,data,flash,flashstorage,flash-storage,eeprom,emulated-eeprom", "description": "The FlashStorage library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory of SAMD21/SAMD51. 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.", "authors": [ @@ -32,5 +32,5 @@ "license": "LGPL-3.0", "frameworks": "arduino", "platforms": "atmelsam", - "headers": ["FlashStorage_SAMD.h", "FlashStorage_SAMD.hpp"] + "headers": ["FlashStorage_SAMD.h", "FlashStorage_SAMD.hpp", "FlashAsEEPROM_SAMD.h", "FlashAsEEPROM_SAMD.hpp"] } diff --git a/library.properties b/library.properties index 3397410..7ff4992 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=FlashStorage_SAMD -version=1.3.1 +version=1.3.2 author=Cristian Maglie , Khoi Hoang maintainer=Khoi Hoang license=GPLv3 @@ -8,4 +8,4 @@ paragraph=Useful if the EEPROM is not available or too small. Currently, ATSAMD2 url=https://github.com/khoih-prog/FlashStorage_SAMD architectures=samd category=Data Storage -includes=FlashStorage_SAMD.h,FlashStorage_SAMD.hpp +includes=FlashStorage_SAMD.h,FlashStorage_SAMD.hpp,FlashAsEEPROM_SAMD.h,FlashAsEEPROM_SAMD.hpp diff --git a/src/FlashAsEEPROM_SAMD.h b/src/FlashAsEEPROM_SAMD.h new file mode 100644 index 0000000..7980a11 --- /dev/null +++ b/src/FlashAsEEPROM_SAMD.h @@ -0,0 +1,49 @@ +/****************************************************************************************************************************************** + FlashAsEEPROM_SAMD.h + For SAMD21/SAMD51 using Flash emulated-EEPROM + + The FlashStorage_SAMD library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory + of SAMD21/SAMD51. It now supports writing and reading the whole object, not just byte-and-byte. + + Based on and modified from Cristian Maglie's FlashStorage (https://github.com/cmaglie/FlashStorage) + + Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_SAMD + Licensed under LGPLv3 license + + Orginally written by Cristian Maglie + + Copyright (c) 2015 Arduino LLC. All right reserved. + Copyright (c) 2020 Khoi Hoang. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License + as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program 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. + You should have received a copy of the GNU Lesser General Public License along with this library. + If not, see (https://www.gnu.org/licenses/) + + Version: 1.3.2 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 28/03/2020 Initial coding to add support to SAMD51 besides SAMD21 + 1.1.0 K Hoang 26/01/2021 Add supports to put() and get() for writing and reading the whole object. Fix bug. + 1.2.0 K Hoang 18/08/2021 Optimize code. Add debug option + 1.2.1 K Hoang 10/10/2021 Update `platform.ini` and `library.json` + 1.3.0 K Hoang 25/01/2022 Fix `multiple-definitions` linker error. Add support to many more boards. + 1.3.1 K Hoang 25/01/2022 Reduce number of library files + 1.3.2 K Hoang 26/01/2022 Make compatible with old libraries and codes + ******************************************************************************************************************************************/ + +// The .hpp contains only definitions, and can be included as many times as necessary, without `Multiple Definitions` Linker Error +// The .h contains implementations, and can be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error + +#pragma once + +#ifndef FlashAsEEPROM_SAMD_h +#define FlashAsEEPROM_SAMD_h + +#include +#include + +#endif //#ifndef FlashAsEEPROM_SAMD_h diff --git a/src/FlashAsEEPROM_SAMD.hpp b/src/FlashAsEEPROM_SAMD.hpp new file mode 100644 index 0000000..4f1b540 --- /dev/null +++ b/src/FlashAsEEPROM_SAMD.hpp @@ -0,0 +1,48 @@ +/****************************************************************************************************************************************** + FlashAsEEPROM_SAMD.hpp + For SAMD21/SAMD51 using Flash emulated-EEPROM + + The FlashStorage_SAMD library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory + of SAMD21/SAMD51. It now supports writing and reading the whole object, not just byte-and-byte. + + Based on and modified from Cristian Maglie's FlashStorage (https://github.com/cmaglie/FlashStorage) + + Built by Khoi Hoang https://github.com/khoih-prog/FlashStorage_SAMD + Licensed under LGPLv3 license + + Orginally written by Cristian Maglie + + Copyright (c) 2015 Arduino LLC. All right reserved. + Copyright (c) 2020 Khoi Hoang. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License + as published bythe Free Software Foundation, either version 3 of the License, or (at your option) any later version. + This program 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. + You should have received a copy of the GNU Lesser General Public License along with this library. + If not, see (https://www.gnu.org/licenses/) + + Version: 1.3.2 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 28/03/2020 Initial coding to add support to SAMD51 besides SAMD21 + 1.1.0 K Hoang 26/01/2021 Add supports to put() and get() for writing and reading the whole object. Fix bug. + 1.2.0 K Hoang 18/08/2021 Optimize code. Add debug option + 1.2.1 K Hoang 10/10/2021 Update `platform.ini` and `library.json` + 1.3.0 K Hoang 25/01/2022 Fix `multiple-definitions` linker error. Add support to many more boards. + 1.3.1 K Hoang 25/01/2022 Reduce number of library files + 1.3.2 K Hoang 26/01/2022 Make compatible with old libraries and codes + ******************************************************************************************************************************************/ + +// The .hpp contains only definitions, and can be included as many times as necessary, without `Multiple Definitions` Linker Error +// The .h contains implementations, and can be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error + +#pragma once + +#ifndef FlashAsEEPROM_SAMD_hpp +#define FlashAsEEPROM_SAMD_hpp + +#include + +#endif //#ifndef FlashAsEEPROM_SAMD_hpp diff --git a/src/FlashStorage_SAMD.h b/src/FlashStorage_SAMD.h index 4ef4eae..4f09153 100644 --- a/src/FlashStorage_SAMD.h +++ b/src/FlashStorage_SAMD.h @@ -22,7 +22,7 @@ You should have received a copy of the GNU Lesser General Public License along with this library. If not, see (https://www.gnu.org/licenses/) - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -32,6 +32,7 @@ 1.2.1 K Hoang 10/10/2021 Update `platform.ini` and `library.json` 1.3.0 K Hoang 25/01/2022 Fix `multiple-definitions` linker error. Add support to many more boards. 1.3.1 K Hoang 25/01/2022 Reduce number of library files + 1.3.2 K Hoang 26/01/2022 Make compatible with old libraries and codes ******************************************************************************************************************************************/ // The .hpp contains only definitions, and can be included as many times as necessary, without `Multiple Definitions` Linker Error diff --git a/src/FlashStorage_SAMD.hpp b/src/FlashStorage_SAMD.hpp index 97dde40..fec9095 100644 --- a/src/FlashStorage_SAMD.hpp +++ b/src/FlashStorage_SAMD.hpp @@ -22,7 +22,7 @@ You should have received a copy of the GNU Lesser General Public License along with this library. If not, see (https://www.gnu.org/licenses/) - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -32,6 +32,7 @@ 1.2.1 K Hoang 10/10/2021 Update `platform.ini` and `library.json` 1.3.0 K Hoang 25/01/2022 Fix `multiple-definitions` linker error. Add support to many more boards. 1.3.1 K Hoang 25/01/2022 Reduce number of library files + 1.3.2 K Hoang 26/01/2022 Make compatible with old libraries and codes ******************************************************************************************************************************************/ // The .hpp contains only definitions, and can be included as many times as necessary, without `Multiple Definitions` Linker Error @@ -54,13 +55,13 @@ #endif #ifndef FLASH_STORAGE_SAMD_VERSION - #define FLASH_STORAGE_SAMD_VERSION "FlashStorage_SAMD v1.3.1" + #define FLASH_STORAGE_SAMD_VERSION "FlashStorage_SAMD v1.3.2" #define FLASH_STORAGE_SAMD_VERSION_MAJOR 1 #define FLASH_STORAGE_SAMD_VERSION_MINOR 3 - #define FLASH_STORAGE_SAMD_VERSION_PATCH 1 + #define FLASH_STORAGE_SAMD_VERSION_PATCH 2 -#define FLASH_STORAGE_SAMD_VERSION_INT 1003001 +#define FLASH_STORAGE_SAMD_VERSION_INT 1003002 #endif diff --git a/src/FlashStorage_SAMD21.h b/src/FlashStorage_SAMD21.h index 81be0c5..001394e 100644 --- a/src/FlashStorage_SAMD21.h +++ b/src/FlashStorage_SAMD21.h @@ -22,7 +22,7 @@ You should have received a copy of the GNU Lesser General Public License along with this library. If not, see (https://www.gnu.org/licenses/) - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -32,6 +32,7 @@ 1.2.1 K Hoang 10/10/2021 Update `platform.ini` and `library.json` 1.3.0 K Hoang 25/01/2022 Fix `multiple-definitions` linker error. Add support to many more boards. 1.3.1 K Hoang 25/01/2022 Reduce number of library files + 1.3.2 K Hoang 26/01/2022 Make compatible with old libraries and codes ******************************************************************************************************************************************/ // The .hpp contains only definitions, and can be included as many times as necessary, without `Multiple Definitions` Linker Error diff --git a/src/FlashStorage_SAMD51.h b/src/FlashStorage_SAMD51.h index d1d6999..6bc32ba 100644 --- a/src/FlashStorage_SAMD51.h +++ b/src/FlashStorage_SAMD51.h @@ -22,7 +22,7 @@ You should have received a copy of the GNU Lesser General Public License along with this library. If not, see (https://www.gnu.org/licenses/) - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -32,6 +32,7 @@ 1.2.1 K Hoang 10/10/2021 Update `platform.ini` and `library.json` 1.3.0 K Hoang 25/01/2022 Fix `multiple-definitions` linker error. Add support to many more boards. 1.3.1 K Hoang 25/01/2022 Reduce number of library files + 1.3.2 K Hoang 26/01/2022 Make compatible with old libraries and codes ******************************************************************************************************************************************/ // The .hpp contains only definitions, and can be included as many times as necessary, without `Multiple Definitions` Linker Error diff --git a/src/FlashStorage_SAMD_Impl.h b/src/FlashStorage_SAMD_Impl.h index b370f9d..14d0aee 100644 --- a/src/FlashStorage_SAMD_Impl.h +++ b/src/FlashStorage_SAMD_Impl.h @@ -22,7 +22,7 @@ You should have received a copy of the GNU Lesser General Public License along with this library. If not, see (https://www.gnu.org/licenses/) - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -32,6 +32,7 @@ 1.2.1 K Hoang 10/10/2021 Update `platform.ini` and `library.json` 1.3.0 K Hoang 25/01/2022 Fix `multiple-definitions` linker error. Add support to many more boards. 1.3.1 K Hoang 25/01/2022 Reduce number of library files + 1.3.2 K Hoang 26/01/2022 Make compatible with old libraries and codes ******************************************************************************************************************************************/ // The .hpp contains only definitions, and can be included as many times as necessary, without `Multiple Definitions` Linker Error