From bf34f16c961c0ddc46d5cdf91fc90006e1831706 Mon Sep 17 00:00:00 2001 From: Khoi Hoang <57012152+khoih-prog@users.noreply.github.com> Date: Sun, 6 Mar 2022 00:18:16 -0500 Subject: [PATCH] v1.8.1 to add waitingForMRD() function ### Releases v1.8.1 1. Add waitingForMRD() function to signal in MRD wating period. Check [DRD is waiting for a double reset? #14](https://github.com/khoih-prog/ESP_DoubleResetDetector/discussions/14) 2. Add example [checkWaitingMRD](https://github.com/khoih-prog/MultiResetDetector_Generic/tree/main/examples/checkWaitingMRD) to demo how to use the new feature. 3. Add support to `Sparkfun Pro nRF52840 Mini` 4. Update `Packages' Patches` --- CONTRIBUTING.md | 6 +- README.md | 238 +++++++++++------------------ changelog.md | 8 + keywords.txt | 1 + library.json | 2 +- library.properties | 2 +- src/MultiResetDetector_Generic.h | 168 ++++++++++++++------ src/mbed_portenta/FlashIAPLimits.h | 5 +- 8 files changed, 230 insertions(+), 200 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dbafba6..5a0c2e5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,7 +15,7 @@ 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.19) or Platform.io version -* `SAMD` Core Version (e.g. Arduino SAMD core v1.8.12, Adafruit SAMD core v1.7.7, Seeed Studio SAMD v1.8.2) +* `SAMD` Core Version (e.g. Arduino SAMD core v1.8.13, Adafruit SAMD core v1.7.9, Seeed Studio SAMD v1.8.2) * 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: @@ -27,9 +27,9 @@ Please ensure to specify the following: ``` Arduino IDE version: 1.8.19 -Arduino SAMD Core Version 1.8.12 +Arduino SAMD Core Version 1.8.13 OS: Ubuntu 20.04 LTS -Linux xy-Inspiron-3593 5.4.0-96-generic #109-Ubuntu SMP Wed Jan 12 16:49:16 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux +Linux kh-Inspiron-3593 5.4.0-100-generic #113-Ubuntu SMP Thu Feb 3 18:43:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Context: I encountered an endless loop while trying to connect to Local WiFi. diff --git a/README.md b/README.md index 8bba5fa..8724457 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing) [![GitHub issues](https://img.shields.io/github/issues/khoih-prog/MultiResetDetector_Generic.svg)](http://github.com/khoih-prog/MultiResetDetector_Generic/issues) -Buy Me A Coffee +Donate to my libraries using BuyMeACoffee + --- --- @@ -43,6 +44,7 @@ * [How It Works](#how-it-works) * [Examples](#examples) * [ 1. minimal](examples/minimal) + * [ 2. checkWaitingMRD](examples/checkWaitingMRD) **New** * [Many other libraries are depending on this library's DRD and MRD feature](#many-other-libraries-are-depending-on-this-librarys-drd-and-mrd-feature) * [ 1. BlynkEthernet_WM](https://github.com/khoih-prog/BlynkEthernet_WM) * [ 2. Blynk_Esp8266AT_WM](https://github.com/khoih-prog/Blynk_Esp8266AT_WM) @@ -54,7 +56,7 @@ * [ 8. Ethernet_Manager](https://github.com/khoih-prog/Ethernet_Manager) * [ 9. Ethernet_Manager_STM32](https://github.com/khoih-prog/Ethernet_Manager_STM32) * [10. WiFiManager_Generic_Lite](https://github.com/khoih-prog/WiFiManager_Generic_Lite) -* [Example minimal](#example-minimal) +* [Example checkWaitingMRD](#example-checkWaitingMRD) * [Debug Terminal Output Samples](#debug-terminal-output-samples) * [1. minimal on Adafruit Itsy-Bitsy nRF52840 Express using LittleFS](#1-minimal-on-adafruit-itsy-bitsy-nrf52840-express-using-littlefs) * [ 1.1 Data Corrupted => reset to 0](#11-data-corrupted--reset-to-0) @@ -172,7 +174,9 @@ This library can be used to detect a multi reset within a predetermined time to This [**MultiResetDetector_Generic** library](https://github.com/khoih-prog/MultiResetDetector_Generic) currently supports these following boards: - 1. **nRF52 boards**, such as **AdaFruit Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc.** + 1. **nRF52 boards**, such as + - **AdaFruit Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc.** + - - **Sparkfun Pro nRF52840 Mini** 2. **SAM DUE** @@ -226,14 +230,14 @@ This [**MultiResetDetector_Generic** library](https://github.com/khoih-prog/Mult 2. [`Arduino Core for STM32 v2.2.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) 3. [`Teensy core 1.56+`](https://www.pjrc.com/teensy/td_download.html) for Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0, LC) boards 4. [`Arduino SAM DUE core 1.6.12+`](https://github.com/arduino/ArduinoCore-sam) for SAM DUE ARM Cortex-M3 boards - 5. [`Arduino SAMD core 1.8.12+`](https://www.arduino.cc/en/Guide/ArduinoM0) for SAMD ARM Cortex-M0+ boards. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-samd.svg)](https://github.com/arduino/ArduinoCore-samd/releases/latest) - 6. [`Adafruit SAMD core 1.7.8+`](https://www.adafruit.com/) for SAMD ARM Cortex-M0+ and M4 boards (Nano 33 IoT, etc.). [![GitHub release](https://img.shields.io/github/release/adafruit/ArduinoCore-samd.svg)](https://github.com/adafruit/ArduinoCore-samd/releases/latest) + 5. [`Arduino SAMD core 1.8.13+`](https://www.arduino.cc/en/Guide/ArduinoM0) for SAMD ARM Cortex-M0+ boards. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-samd.svg)](https://github.com/arduino/ArduinoCore-samd/releases/latest) + 6. [`Adafruit SAMD core 1.7.9+`](https://www.adafruit.com/) for SAMD ARM Cortex-M0+ and M4 boards (Nano 33 IoT, etc.). [![GitHub release](https://img.shields.io/github/release/adafruit/ArduinoCore-samd.svg)](https://github.com/adafruit/ArduinoCore-samd/releases/latest) 7. [`Seeeduino SAMD core 1.8.2+`](https://github.com/Seeed-Studio/ArduinoCore-samd) for SAMD21/SAMD51 boards (XIAO M0, Wio Terminal, etc.). [![Latest release](https://img.shields.io/github/release/Seeed-Studio/ArduinoCore-samd.svg)](https://github.com/Seeed-Studio/ArduinoCore-samd/releases/latest/) 8. [`Adafruit nRF52 v1.3.0+`](https://www.adafruit.com) for nRF52 boards such as Adafruit NRF52840_FEATHER, NRF52832_FEATHER, NRF52840_FEATHER_SENSE, NRF52840_ITSYBITSY, NRF52840_CIRCUITPLAY, NRF52840_CLUE, NRF52840_METRO, NRF52840_PCA10056, PARTICLE_XENON, **NINA_B302_ublox**, etc. [![GitHub release](https://img.shields.io/github/release/adafruit/Adafruit_nRF52_Arduino.svg)](https://github.com/adafruit/Adafruit_nRF52_Arduino/releases/latest) - 9. [`Earle Philhower's arduino-pico core v1.10.0+`](https://github.com/earlephilhower/arduino-pico) for RP2040-based boards such as **RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040**, etc. [![GitHub release](https://img.shields.io/github/release/earlephilhower/arduino-pico.svg)](https://github.com/earlephilhower/arduino-pico/releases/latest) -10. [`Arduino mbed_rp2040 core 2.6.1+`](https://github.com/arduino/ArduinoCore-mbed) for Arduino (Use Arduino Board Manager) RP2040-based boards, such as **Arduino Nano RP2040 Connect, RASPBERRY_PI_PICO, etc.**. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-mbed.svg)](https://github.com/arduino/ArduinoCore-mbed/releases/latest) -11. [`Arduino mbed_nano core 2.6.1+`](https://github.com/arduino/ArduinoCore-mbed) for Arduino (Use Arduino Board Manager) MBED nRF52840-based boards such as **Nano_33_BLE, Nano_33_BLE_Sense**. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-mbed.svg)](https://github.com/arduino/ArduinoCore-mbed/releases/latest) -12. [`ArduinoCore-mbed mbed_portenta core 2.6.1+`](https://github.com/arduino/ArduinoCore-mbed) for Arduino **Portenta_H7**. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-mbed.svg)](https://github.com/arduino/ArduinoCore-mbed/releases/latest) + 9. [`Earle Philhower's arduino-pico core v1.12.0+`](https://github.com/earlephilhower/arduino-pico) for RP2040-based boards such as **RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040**, etc. [![GitHub release](https://img.shields.io/github/release/earlephilhower/arduino-pico.svg)](https://github.com/earlephilhower/arduino-pico/releases/latest) +10. [`Arduino mbed_rp2040 core 2.7.2+`](https://github.com/arduino/ArduinoCore-mbed) for Arduino (Use Arduino Board Manager) RP2040-based boards, such as **Arduino Nano RP2040 Connect, RASPBERRY_PI_PICO, etc.**. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-mbed.svg)](https://github.com/arduino/ArduinoCore-mbed/releases/latest) +11. [`Arduino mbed_nano core 2.7.2+`](https://github.com/arduino/ArduinoCore-mbed) for Arduino (Use Arduino Board Manager) MBED nRF52840-based boards such as **Nano_33_BLE, Nano_33_BLE_Sense**. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-mbed.svg)](https://github.com/arduino/ArduinoCore-mbed/releases/latest) +12. [`ArduinoCore-mbed mbed_portenta core 2.7.2+`](https://github.com/arduino/ArduinoCore-mbed) for Arduino **Portenta_H7**. [![GitHub release](https://img.shields.io/github/release/arduino/ArduinoCore-mbed.svg)](https://github.com/arduino/ArduinoCore-mbed/releases/latest) 13. [`Arduino AmebaD core 3.1.2+`](https://github.com/ambiot/ambd_arduino) for Realtek RTL8720DN, RTL8722DM and RTL8722CSM, etc. boards. [![GitHub release](https://img.shields.io/github/release/ambiot/ambd_arduino.svg)](https://github.com/ambiot/ambd_arduino/releases/latest) 14. [`FlashStorage_SAMD library v1.3.2+`](https://github.com/khoih-prog/FlashStorage_SAMD) for SAMD21 and SAMD51 boards (ZERO, MKR, NANO_33_IOT, M0, M0 Pro, AdaFruit Itsy-Bitsy M4, etc.). [![GitHub release](https://img.shields.io/github/release/khoih-prog/FlashStorage_SAMD.svg)](https://github.com/khoih-prog/FlashStorage_SAMD/releases/latest) @@ -266,7 +270,7 @@ Another way to install is to: 1. Install [VS Code](https://code.visualstudio.com/) 2. Install [PlatformIO](https://platformio.org/platformio-ide) -3. Install [**MultiResetDetector_Generic** library](https://platformio.org/lib/show/11630/MultiResetDetector_Generic) by using [Library Manager](https://platformio.org/lib/show/11630/MultiResetDetector_Generic/installation). Search for **MultiResetDetector_Generic** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22) +3. Install [**MultiResetDetector_Generic** library](https://registry.platformio.org/libraries/khoih-prog/MultiResetDetector_Generic) by using [Library Manager](https://registry.platformio.org/libraries/khoih-prog/MultiResetDetector_Generic/installation). Search for **MultiResetDetector_Generic** in [Platform.io Author's Libraries](https://platformio.org/lib/search?query=author:%22Khoi%20Hoang%22) 4. Use included [platformio.ini](platformio/platformio.ini) file from examples to ensure that all dependent libraries will installed automatically. Please visit documentation for the other options and examples at [Project Configuration File](https://docs.platformio.org/page/projectconf.html) --- @@ -338,13 +342,13 @@ This file must be copied into the directory: #### 4. For Arduino SAMD boards - ***To be able to compile, run and automatically detect and display BOARD_NAME on Arduino SAMD (Nano-33-IoT, etc) boards***, you have to copy the whole [Arduino SAMD Packages_Patches](Packages_Patches/arduino/hardware/samd/1.8.12) directory into Arduino SAMD directory (~/.arduino15/packages/arduino/hardware/samd/1.8.12). + ***To be able to compile, run and automatically detect and display BOARD_NAME on Arduino SAMD (Nano-33-IoT, etc) boards***, you have to copy the whole [Arduino SAMD Packages_Patches](Packages_Patches/arduino/hardware/samd/1.8.13) directory into Arduino SAMD directory (~/.arduino15/packages/arduino/hardware/samd/1.8.13). #### For core version v1.8.10+ -Supposing the Arduino SAMD version is 1.8.12. Now only one file must be copied into the directory: +Supposing the Arduino SAMD version is 1.8.13. Now only one file must be copied into the directory: -- `~/.arduino15/packages/arduino/hardware/samd/1.8.12/platform.txt` +- `~/.arduino15/packages/arduino/hardware/samd/1.8.13/platform.txt` Whenever a new version is installed, remember to copy this files into the new version directory. For example, new version is x.yy.zz @@ -377,13 +381,13 @@ Whenever the above-mentioned compiler error issue is fixed with the new Arduino #### 5. For Adafruit SAMD boards - ***To be able to compile, run and automatically detect and display BOARD_NAME on Adafruit SAMD (Itsy-Bitsy M4, etc) boards***, you have to copy the whole [Adafruit SAMD Packages_Patches](Packages_Patches/adafruit/hardware/samd/1.7.7) directory into Adafruit samd directory (~/.arduino15/packages/adafruit/hardware/samd/1.7.7). + ***To be able to compile, run and automatically detect and display BOARD_NAME on Adafruit SAMD (Itsy-Bitsy M4, etc) boards***, you have to copy the whole [Adafruit SAMD Packages_Patches](Packages_Patches/adafruit/hardware/samd/1.7.9) directory into Adafruit samd directory (~/.arduino15/packages/adafruit/hardware/samd/1.7.9). -Supposing the Adafruit SAMD core version is 1.7.7. This file must be copied into the directory: +Supposing the Adafruit SAMD core version is 1.7.9. This file must be copied into the directory: -- `~/.arduino15/packages/adafruit/hardware/samd/1.7.7/platform.txt` -- `~/.arduino15/packages/adafruit/hardware/samd/1.7.7/cores/arduino/Print.h` -- `~/.arduino15/packages/adafruit/hardware/samd/1.7.7/cores/arduino/Print.cpp` +- `~/.arduino15/packages/adafruit/hardware/samd/1.7.9/platform.txt` +- `~/.arduino15/packages/adafruit/hardware/samd/1.7.9/cores/arduino/Print.h` +- `~/.arduino15/packages/adafruit/hardware/samd/1.7.9/cores/arduino/Print.cpp` Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory: @@ -485,12 +489,12 @@ With core after v1.5.0, this step is not necessary anymore thanks to the PR [Add #### 9. For Portenta_H7 boards using Arduino IDE in Linux - **To be able to upload firmware to Portenta_H7 using Arduino IDE in Linux (Ubuntu, etc.)**, you have to copy the file [portenta_post_install.sh](Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/portenta_post_install.sh) into mbed_portenta directory (~/.arduino15/packages/arduino/hardware/mbed_portenta/2.6.1/portenta_post_install.sh). + **To be able to upload firmware to Portenta_H7 using Arduino IDE in Linux (Ubuntu, etc.)**, you have to copy the file [portenta_post_install.sh](Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/portenta_post_install.sh) into mbed_portenta directory (~/.arduino15/packages/arduino/hardware/mbed_portenta/2.7.2/portenta_post_install.sh). Then run the following command using `sudo` ``` -$ cd ~/.arduino15/packages/arduino/hardware/mbed_portenta/2.6.1 +$ cd ~/.arduino15/packages/arduino/hardware/mbed_portenta/2.7.2 $ chmod 755 portenta_post_install.sh $ sudo ./portenta_post_install.sh ``` @@ -503,9 +507,9 @@ This will create the file `/etc/udev/rules.d/49-portenta_h7.rules` as follows: SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="035b", GROUP="plugdev", MODE="0666" ``` -Supposing the ArduinoCore-mbed core version is 2.6.1. Now only one file must be copied into the directory: +Supposing the ArduinoCore-mbed core version is 2.7.2. Now only one file must be copied into the directory: -- `~/.arduino15/packages/arduino/hardware/mbed_portenta/2.6.1/portenta_post_install.sh` +- `~/.arduino15/packages/arduino/hardware/mbed_portenta/2.7.2/portenta_post_install.sh` Whenever a new version is installed, remember to copy this files into the new version directory. For example, new version is x.yy.zz @@ -529,6 +533,7 @@ Detects a multi reset so that an alternative start-up mode can be used. One exam ### Examples: 1. [minimal](examples/minimal) + 2. [checkWaitingMRD](examples/checkWaitingMRD) **New** #### Many other libraries are depending on this library's DRD and MRD feature @@ -549,72 +554,10 @@ Detects a multi reset so that an alternative start-up mode can be used. One exam --- -#### Example [minimal](examples/minimal) +#### Example [checkWaitingMRD](examples/checkWaitingMRD) -```cpp -#define MRD_GENERIC_DEBUG true //false - -// These definitions must be placed before #include to be used -// Otherwise, default values (MRD_TIMES = 3, MRD_TIMEOUT = 10 seconds and MRD_ADDRESS = 0) will be used -// Number of subsequent resets during MRD_TIMEOUT to activate -#define MRD_TIMES 5 - -// Number of seconds after reset during which a -// subsequent reset will be considered a multi reset. -#define MRD_TIMEOUT 10 - -// RTC/EEPROM Memory Address for the MultiResetDetector to use -#define MRD_ADDRESS 0 - -#include - -MultiResetDetector_Generic* mrd; - -#ifndef LED_BUILTIN - #define LED_BUILTIN 13 -#endif - -void setup() -{ - pinMode(LED_BUILTIN, OUTPUT); +https://github.com/khoih-prog/MultiResetDetector_Generic/blob/33fbdba9711d58e6879c22ee7681d72c57e6c50e/examples/checkWaitingMRD/checkWaitingMRD.ino#L52-L165 - Serial.begin(115200); - while (!Serial); - - Serial.println(); - -#if defined(BOARD_NAME) - Serial.print(F("MultiResetDetector minimal Example Program on ")); Serial.println(BOARD_NAME); -#else - Serial.println(F("MultiResetDetector minimal Example Program")); -#endif - - Serial.println(MULTIRESETDETECTOR_GENERIC_VERSION); - Serial.println(F("-----------------------------------")); - - mrd = new MultiResetDetector_Generic(MRD_TIMEOUT, MRD_ADDRESS) - - if (mrd->detectMultiReset()) - { - Serial.println(F("Multi Reset Detected")); - digitalWrite(LED_BUILTIN, LOW); - } - else - { - Serial.println(F("No Multi Reset Detected")); - digitalWrite(LED_BUILTIN, HIGH); - } -} - -void loop() -{ - // Call the multi reset detector loop method every so often, - // so that it can recognise when the timeout expires. - // You can also call mrd.stop() when you wish to no longer - // consider the next reset as a multi reset. - mrd->loop(); -} -``` --- @@ -629,7 +572,7 @@ This is terminal debug output when running [minimal](examples/minimal) on ***Ada ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS Flag read = 0xfffe0001 multiResetDetectorFlag = 0xfffe0001 @@ -651,7 +594,7 @@ ClearFlag write = 0xfffe0001 ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS Flag read = 0xfffe0001 multiResetDetectorFlag = 0xfffe0001 @@ -668,7 +611,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS Flag read = 0xfffd0002 multiResetDetectorFlag = 0xfffd0002 @@ -685,7 +628,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS Flag read = 0xfffc0003 multiResetDetectorFlag = 0xfffc0003 @@ -702,7 +645,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS Flag read = 0xfffb0004 multiResetDetectorFlag = 0xfffb0004 @@ -719,7 +662,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS Flag read = 0xfffa0005 multiResetDetectorFlag = 0xfffa0005 @@ -743,7 +686,7 @@ This is terminal debug output when running [minimal](examples/minimal) on ***Tee ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- EEPROM size = 1080, start = 0 @@ -761,7 +704,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- EEPROM size = 1080, start = 0 @@ -776,7 +719,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- EEPROM size = 1080, start = 0 @@ -791,7 +734,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- EEPROM size = 1080, start = 0 @@ -806,7 +749,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- EEPROM size = 1080, start = 0 @@ -821,7 +764,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- EEPROM size = 1080, start = 0 @@ -843,7 +786,7 @@ This is terminal debug output when running [minimal](examples/minimal) on ***SAM ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- multiResetDetectorFlag = 0xffff0000 lowerBytes = 0x0, upperBytes = 0x0 @@ -858,7 +801,7 @@ ClearFlag write = 0xfffe0001 ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- multiResetDetectorFlag = 0xfffe0001 lowerBytes = 0x1, upperBytes = 0x1 @@ -871,7 +814,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- multiResetDetectorFlag = 0xfffd0002 lowerBytes = 0x2, upperBytes = 0x2 @@ -884,7 +827,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- multiResetDetectorFlag = 0xfffc0003 lowerBytes = 0x3, upperBytes = 0x3 @@ -897,7 +840,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- multiResetDetectorFlag = 0xfffb0004 lowerBytes = 0x4, upperBytes = 0x4 @@ -910,7 +853,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- multiResetDetectorFlag = 0xfffa0005 lowerBytes = 0x5, upperBytes = 0x5 @@ -930,7 +873,7 @@ This is terminal debug output when running [minimal](examples/minimal) on ***Ard ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- multiResetDetectorFlag = 0xffffffff lowerBytes = 0xffff, upperBytes = 0x0 @@ -946,7 +889,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- multiResetDetectorFlag = 0xfffe0001 lowerBytes = 0x1, upperBytes = 0x1 @@ -959,7 +902,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- multiResetDetectorFlag = 0xfffd0002 lowerBytes = 0x2, upperBytes = 0x2 @@ -972,7 +915,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- multiResetDetectorFlag = 0xfffc0003 lowerBytes = 0x3, upperBytes = 0x3 @@ -985,7 +928,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- multiResetDetectorFlag = 0xfffb0004 lowerBytes = 0x4, upperBytes = 0x4 @@ -998,7 +941,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- multiResetDetectorFlag = 0xfffa0005 lowerBytes = 0x5, upperBytes = 0x5 @@ -1018,7 +961,7 @@ This is terminal debug output when running [minimal](examples/minimal) on **STM3 ``` MultiResetDetector minimal Example Program on NUCLEO_F767ZI -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- (Emulated-)EEPROM size = 16384, start = 0 @@ -1036,7 +979,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on NUCLEO_F767ZI -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- (Emulated-)EEPROM size = 16384, start = 0 @@ -1051,7 +994,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on NUCLEO_F767ZI -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- (Emulated-)EEPROM size = 16384, start = 0 @@ -1066,7 +1009,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on NUCLEO_F767ZI -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- (Emulated-)EEPROM size = 16384, start = 0 @@ -1081,7 +1024,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on NUCLEO_F767ZI -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- (Emulated-)EEPROM size = 16384, start = 0 @@ -1096,7 +1039,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on NUCLEO_F767ZI -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- (Emulated-)EEPROM size = 16384, start = 0 @@ -1118,7 +1061,7 @@ This is terminal debug output when running [minimal](examples/minimal) on **RASP ``` MultiResetDetector minimal Example Program on RASPBERRY_PI_PICO -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- Loading MRD file failed @@ -1142,7 +1085,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on RASPBERRY_PI_PICO -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS Flag read = 0xfffe0001 multiResetDetectorFlag = 0xfffe0001 @@ -1159,7 +1102,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS Flag read = 0xfffd0002 multiResetDetectorFlag = 0xfffd0002 @@ -1176,7 +1119,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on RASPBERRY_PI_PICO -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS Flag read = 0xfffc0003 multiResetDetectorFlag = 0xfffc0003 @@ -1193,7 +1136,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on RASPBERRY_PI_PICO -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS Flag read = 0xfffb0004 multiResetDetectorFlag = 0xfffb0004 @@ -1210,7 +1153,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on RASPBERRY_PI_PICO -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS Flag read = 0xfffa0005 multiResetDetectorFlag = 0xfffa0005 @@ -1234,7 +1177,7 @@ This is terminal debug output when running [minimal](examples/minimal) on **Nano ``` MultiResetDetector minimal Example Program on Nano RP2040 Connect -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1259,7 +1202,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on Nano RP2040 Connect -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1278,7 +1221,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on Nano RP2040 Connect -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1297,7 +1240,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on Nano RP2040 Connect -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1316,7 +1259,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on Nano RP2040 Connect -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1335,7 +1278,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on Nano RP2040 Connect -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1361,7 +1304,7 @@ This is terminal debug output when running [minimal](examples/minimal) on **MBED ``` MultiResetDetector minimal Example Program on RaspberryPi Pico -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1386,7 +1329,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on RaspberryPi Pico -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1405,7 +1348,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on RaspberryPi Pico -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1424,7 +1367,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on RaspberryPi Pico -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1443,7 +1386,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on RaspberryPi Pico -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1462,7 +1405,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on RaspberryPi Pico -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1488,7 +1431,7 @@ This is terminal debug output when running [minimal](examples/minimal) on **MBED ``` MultiResetDetector minimal Example Program on Nano 33 BLE -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1518,7 +1461,7 @@ ClearFlag write = 0xfffe0001 ``` MultiResetDetector minimal Example Program on Nano 33 BLE -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1537,7 +1480,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on Nano 33 BLE -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1561,7 +1504,7 @@ ClearFlag write = 0xfffe0001 ``` MultiResetDetector minimal Example Program on Nano 33 BLE -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1580,7 +1523,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on Nano 33 BLE -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1599,7 +1542,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on Nano 33 BLE -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- LittleFS size (KB) = 64 LittleFS Mount OK @@ -1627,7 +1570,7 @@ This is terminal debug output when running [minimal](examples/minimal) on **MBED ``` MultiResetDetector minimal Example Program on PORTENTA_H7_M7 -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- Flash Size: (KB) = 2048.00 FlashIAP Start Address: = 0x8080000 @@ -1659,7 +1602,7 @@ ClearFlag write = 0xfffe0001 ``` MultiResetDetector minimal Example Program on PORTENTA_H7_M7 -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- Flash Size: (KB) = 2048.00 FlashIAP Start Address: = 0x8080000 @@ -1680,7 +1623,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on PORTENTA_H7_M7 -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- Flash Size: (KB) = 2048.00 FlashIAP Start Address: = 0x8080000 @@ -1701,7 +1644,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on PORTENTA_H7_M7 -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- Flash Size: (KB) = 2048.00 FlashIAP Start Address: = 0x8080000 @@ -1722,7 +1665,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on PORTENTA_H7_M7 -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- Flash Size: (KB) = 2048.00 FlashIAP Start Address: = 0x8080000 @@ -1743,7 +1686,7 @@ No Multi Reset Detected ``` MultiResetDetector minimal Example Program on PORTENTA_H7_M7 -MultiResetDetector_Generic v1.8.0 +MultiResetDetector_Generic v1.8.1 ----------------------------------- Flash Size: (KB) = 2048.00 FlashIAP Start Address: = 0x8080000 @@ -1844,7 +1787,8 @@ Submit issues to: [MultiResetDetector_Generic issues](https://github.com/khoih-p 19. Update to be compatible with new `FlashStorage_SAMD`, `FlashStorage_STM32` and `FlashStorage_STM32F1` libraries. 20. Use more efficient `FlashStorage_STM32` and `FlashStorage_STM32F1` libraries for STM32 21. Add support to more `SAMD` and `STM32` boards - +22. Add support to `Sparkfun Pro nRF52840 Mini` +23. Add waitingForMRD() function to signal in MRD wating period --- --- diff --git a/changelog.md b/changelog.md index 21e3bc1..0060603 100644 --- a/changelog.md +++ b/changelog.md @@ -12,6 +12,7 @@ ## Table of Contents * [Changelog](#changelog) + * [Releases v1.8.1](#releases-v181) * [Releases v1.8.0](#releases-v180) * [Releases v1.7.3](#releases-v173) * [Releases v1.7.2](#releases-v172) @@ -30,6 +31,13 @@ ## Changelog +### Releases v1.8.1 + +1. Add waitingForMRD() function to signal in MRD wating period. Check [DRD is waiting for a double reset? #14](https://github.com/khoih-prog/ESP_DoubleResetDetector/discussions/14) +2. Add example [checkWaitingMRD](https://github.com/khoih-prog/MultiResetDetector_Generic/tree/main/examples/checkWaitingMRD) to demo how to use the new feature. +3. Add support to `Sparkfun Pro nRF52840 Mini` +4. Update `Packages' Patches` + ### Releases v1.8.0 1. Update to be compatible with new `FlashStorage_SAMD`, `FlashStorage_STM32` and `FlashStorage_STM32F1` libraries. diff --git a/keywords.txt b/keywords.txt index df4dcaf..1b832d5 100644 --- a/keywords.txt +++ b/keywords.txt @@ -13,6 +13,7 @@ MultiResetDetector_Generic ####################################### detectMultiReset KEYWORD2 +waitingForMRD KEYWORD2 loop KEYWORD2 stop KEYWORD2 diff --git a/library.json b/library.json index 0ee4961..204da94 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "MultiResetDetector_Generic", - "version": "1.8.0", + "version": "1.8.1", "keywords": "device, control, flashstorage-samd, flashstorage-stm32, nano-rp2040-connect, nano-33-ble, samd, stm32, nRF52, portenta-h7, rp2040, multi-reset, flashstorage, mbed-portenta, portenta-h7, portentah7, dueflashstorage, littlefs, spiffs, mbed-portenta, teensy, sam-due, mbed, rpi-pico, raspberry-pico, flashstorage-rtl8720, eeprom, reset, detector, data", "description": "Library to detect a multi reset, using EEPROM, DueFlashStorage, FlashStorage_SAMD, FlashStorage_RTL8720, FlashStorage_STM32 or LittleFS/InternalFS. For AVR, Teensy, SAM DUE, SAMD, STM32F/L/H/G/WB/MP1, nRF52, RP2040-based Nano_RP2040_Connect, RASPBERRY_PI_PICO, RTL8720DN, MBED nRF52840-based Nano_33_BLE, Portenta_H7, etc. boards. Now using efficient FlashStorage_STM32 library and supporting new RP2040-based Nano_RP2040_Connect, RASPBERRY_PI_PICO and STM32 core v2.0.0+", "authors": diff --git a/library.properties b/library.properties index 31812ef..3c5a18c 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=MultiResetDetector_Generic -version=1.8.0 +version=1.8.1 author=Khoi Hoang maintainer=Khoi Hoang license=MIT diff --git a/src/MultiResetDetector_Generic.h b/src/MultiResetDetector_Generic.h index c50cb4f..3eaf24d 100644 --- a/src/MultiResetDetector_Generic.h +++ b/src/MultiResetDetector_Generic.h @@ -13,7 +13,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/MultiResetDetector_Generic Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -29,6 +29,7 @@ 1.7.2 K Hoang 14/09/2021 Back to using auto LittleFS to fix bug 1.7.3 K Hoang 10/10/2021 Update `platform.ini` and `library.json` 1.8.0 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. Add support to more SAMD/STM32 boards + 1.8.1 K Hoang 05/03/2022 Add waitingForMRD() function to signal in MRD wating period ************************************************************************************************************************************/ #pragma once @@ -36,14 +37,18 @@ #ifndef MultiResetDetector_Generic_H #define MultiResetDetector_Generic_H +#ifndef MRD_GENERIC_DEBUG + #define MRD_GENERIC_DEBUG false +#endif + #ifndef MULTIRESETDETECTOR_GENERIC_VERSION - #define MULTIRESETDETECTOR_GENERIC_VERSION "MultiResetDetector_Generic v1.8.0" + #define MULTIRESETDETECTOR_GENERIC_VERSION "MultiResetDetector_Generic v1.8.1" #define MULTIRESETDETECTOR_GENERIC_VERSION_MAJOR 1 #define MULTIRESETDETECTOR_GENERIC_VERSION_MINOR 8 - #define MULTIRESETDETECTOR_GENERIC_VERSION_PATCH 0 + #define MULTIRESETDETECTOR_GENERIC_VERSION_PATCH 1 -#define MULTIRESETDETECTOR_GENERIC_VERSION_INT 1008000 +#define MULTIRESETDETECTOR_GENERIC_VERSION_INT 1008001 #endif @@ -87,7 +92,10 @@ #undef MRD_GENERIC_USE_EEPROM #endif #define MRD_GENERIC_USE_EEPROM false - #warning Use SAM-DUE and DueFlashStorage + + #if (MRD_GENERIC_DEBUG) + #warning Use SAM-DUE and DueFlashStorage + #endif ///////////////////////////// #elif ( defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) \ @@ -106,8 +114,10 @@ #undef MRD_GENERIC_USE_EEPROM #endif #define MRD_GENERIC_USE_EEPROM false - #warning Use SAMD and FlashStorage - + + #if (MRD_GENERIC_DEBUG) + #warning Use SAMD and FlashStorage + #endif ///////////////////////////// #elif ( defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \ defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || defined(NRF52840_CLUE) || \ @@ -122,7 +132,10 @@ #undef MRD_GENERIC_USE_EEPROM #endif #define MRD_GENERIC_USE_EEPROM false - #warning Use NRF52 and LittleFS / InternalFS + + #if (MRD_GENERIC_DEBUG) + #warning Use NRF52 and LittleFS / InternalFS + #endif ///////////////////////////// #elif ( defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_ARCH_MBED) ) @@ -137,7 +150,9 @@ #endif #define MRD_GENERIC_USE_EEPROM false - #warning Use RP2040 (such as RASPBERRY_PI_PICO) and LittleFS + #if (MRD_GENERIC_DEBUG) + #warning Use RP2040 (such as RASPBERRY_PI_PICO) and LittleFS + #endif ///////////////////////////// #elif ( defined(ARDUINO_ARCH_RP2040) && defined(ARDUINO_ARCH_MBED) ) @@ -146,7 +161,11 @@ // To check and determine if we need to init LittleFS here #if MBED_RP2040_INITIALIZED #define MRD_MBED_LITTLEFS_NEED_INIT false - #warning MBED_RP2040_INITIALIZED in another place + + #if (MRD_GENERIC_DEBUG) + #warning MBED_RP2040_INITIALIZED in another place + #endif + #else // Better to delay until init done #if defined(MBED_RP2040_INITIALIZED) @@ -167,7 +186,9 @@ #endif #define MRD_GENERIC_USE_EEPROM false - #warning Use MBED RP2040 (such as NANO_RP2040_CONNECT, RASPBERRY_PI_PICO) and LittleFS + #if (MRD_GENERIC_DEBUG) + #warning Use MBED RP2040 (such as NANO_RP2040_CONNECT, RASPBERRY_PI_PICO) and LittleFS + #endif ///////////////////////////// #elif ( ( defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) ) && defined(ARDUINO_ARCH_MBED) ) @@ -177,10 +198,16 @@ #endif #if defined(CORE_CM7) - #warning Using Portenta H7 M7 core + #if (MRD_GENERIC_DEBUG) + #warning Using Portenta H7 M7 core + #endif + #define BOARD_NAME "PORTENTA_H7_M7" #else - #warning Using Portenta H7 M4 core + #if (MRD_GENERIC_DEBUG) + #warning Using Portenta H7 M4 core + #endif + #define BOARD_NAME "PORTENTA_H7_M4" #endif @@ -188,7 +215,11 @@ // To check and determine if we need to init LittleFS here #if MBED_PORTENTA_H7_INITIALIZED #define MRD_MBED_LITTLEFS_NEED_INIT false - #warning MBED_PORTENTA_H7_INITIALIZED in another place + + #if (MRD_GENERIC_DEBUG) + #warning MBED_PORTENTA_H7_INITIALIZED in another place + #endif + #else // Better to delay until init done #if defined(MBED_PORTENTA_H7_INITIALIZED) @@ -209,7 +240,9 @@ #endif #define MRD_GENERIC_USE_EEPROM false - #warning Use MBED PORTENTA_H7 and LittleFS + #if (MRD_GENERIC_DEBUG) + #warning Use MBED PORTENTA_H7 and LittleFS + #endif ///////////////////////////// #elif ( defined(ARDUINO_ARCH_NRF52840) && defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARDUINO_NANO33BLE) ) @@ -218,7 +251,11 @@ // To check and determine if we need to init LittleFS here #if NANO33BLE_INITIALIZED #define MRD_NANO33BLE_NEED_INIT false - #warning NANO33BLE_INITIALIZED in another place + + #if (MRD_GENERIC_DEBUG) + #warning NANO33BLE_INITIALIZED in another place + #endif + #else // Better to delay until init done #if defined(NANO33BLE_INITIALIZED) @@ -239,8 +276,26 @@ #endif #define MRD_GENERIC_USE_EEPROM false - #warning Use MBED nRF52840 (such as Nano_33_BLE, Nano_33_BLE_Sense) and LittleFS + #if (MRD_GENERIC_DEBUG) + #warning Use MBED nRF52840 (such as Nano_33_BLE, Nano_33_BLE_Sense) and LittleFS + #endif + +///////////////////////////// +#elif defined(CONFIG_PLATFORM_8721D) + + #if defined(MRD_GENERIC_USE_RTL8720) + #undef MRD_GENERIC_USE_RTL8720 + #endif + #define MRD_GENERIC_USE_RTL8720 true + #if defined(MRD_GENERIC_USE_EEPROM) + #undef MRD_GENERIC_USE_EEPROM + #endif + #define MRD_GENERIC_USE_EEPROM false + #if (MRD_GENERIC_DEBUG) + #warning Use RTL8720 and FlashStorage_RTL8720 + #endif + ///////////////////////////// #elif ( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \ defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \ @@ -253,34 +308,35 @@ #undef MRD_GENERIC_USE_EEPROM #endif #define MRD_GENERIC_USE_EEPROM false - #warning Use STM32 and FlashStorage_STM32 - -///////////////////////////// -#elif defined(CONFIG_PLATFORM_8721D) - - #if defined(MRD_GENERIC_USE_RTL8720) - #undef MRD_GENERIC_USE_RTL8720 - #endif - #define MRD_GENERIC_USE_RTL8720 true - #if defined(MRD_GENERIC_USE_EEPROM) - #undef MRD_GENERIC_USE_EEPROM - #endif - #define MRD_GENERIC_USE_EEPROM false - #warning Use RTL8720 and FlashStorage_RTL8720 + #if (MRD_GENERIC_DEBUG) + #warning Use STM32 and FlashStorage_STM32 + #endif + ///////////////////////////// #else #if defined(CORE_TEENSY) - #warning Use TEENSY and EEPROM + #if (MRD_GENERIC_DEBUG) + #warning Use TEENSY and EEPROM + #endif + #elif ( defined(ARDUINO_AVR_ADK) || defined(ARDUINO_AVR_BT) || defined(ARDUINO_AVR_DUEMILANOVE) || defined(ARDUINO_AVR_ESPLORA) \ || defined(ARDUINO_AVR_ETHERNET) || defined(ARDUINO_AVR_FIO) || defined(ARDUINO_AVR_GEMMA) || defined(ARDUINO_AVR_LEONARDO) \ || defined(ARDUINO_AVR_LILYPAD) || defined(ARDUINO_AVR_LILYPAD_USB) || defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560) \ || defined(ARDUINO_AVR_MICRO) || defined(ARDUINO_AVR_MINI) || defined(ARDUINO_AVR_NANO) || defined(ARDUINO_AVR_NG) \ || defined(ARDUINO_AVR_PRO) || defined(ARDUINO_AVR_ROBOT_CONTROL) || defined(ARDUINO_AVR_ROBOT_MOTOR) || defined(ARDUINO_AVR_UNO) \ - || defined(ARDUINO_AVR_YUN) ) - #warning Use AVR and EEPROM + || defined(ARDUINO_AVR_YUN) ) + + #if (MRD_GENERIC_DEBUG) + #warning Use AVR and EEPROM + #endif + #else - #warning Use Unknown board and EEPROM + + #if (MRD_GENERIC_DEBUG) + #warning Use Unknown board and EEPROM + #endif + #endif #endif @@ -374,7 +430,9 @@ #endif #define MRD_FILENAME "/fs/mrd.dat" - #warning MRD_MBED_LITTLEFS INITIALIZED locally in MultiResetDetector_Generic + #if (MRD_GENERIC_DEBUG) + #warning MRD_MBED_LITTLEFS INITIALIZED locally in MultiResetDetector_Generic + #endif ///////////////////////////// #elif (MRD_GENERIC_USE_MBED_PORTENTA && MRD_PORTENTA_LITTLEFS_NEED_INIT) @@ -409,7 +467,9 @@ #endif #define MRD_FILENAME "/littlefs/mrd.dat" - #warning MRD_PORTENTA_LITTLEFS INITIALIZED locally in MultiResetDetector_Generic + #if (MRD_GENERIC_DEBUG) + #warning MRD_PORTENTA_LITTLEFS INITIALIZED locally in MultiResetDetector_Generic + #endif ///////////////////////////// #elif (MRD_GENERIC_USE_NANO33BLE && MRD_NANO33BLE_NEED_INIT) @@ -464,8 +524,9 @@ #endif #define MRD_FILENAME "/littlefs/mrd.dat" - #warning MRD_NANO33BLE_LITTLEFS INITIALIZED locally in MultiResetDetector_Generic - + #if (MRD_GENERIC_DEBUG) + #warning MRD_NANO33BLE_LITTLEFS INITIALIZED locally in MultiResetDetector_Generic + #endif ///////////////////////////// #elif MRD_GENERIC_USE_STM32 @@ -475,7 +536,11 @@ #if defined(DATA_EEPROM_BASE) // For STM32 devices having integrated EEPROM. #include - #warning STM32 devices have integrated EEPROM. Not using buffered API. + + #if (MRD_GENERIC_DEBUG) + #warning STM32 devices have integrated EEPROM. Not using buffered API. + #endif + #else /** Most STM32 devices don't have an integrated EEPROM. To emulate a EEPROM, the STM32 Arduino core emulated @@ -487,10 +552,18 @@ */ #if ( defined(STM32F1xx) || defined(STM32F3xx) ) #include // https://github.com/khoih-prog/FlashStorage_STM32 - #warning STM32F1/F3 devices have no integrated EEPROM. Using buffered API with FlashStorage_STM32F1 library + + #if (MRD_GENERIC_DEBUG) + #warning STM32F1/F3 devices have no integrated EEPROM. Using buffered API with FlashStorage_STM32F1 library + #endif + #else #include // https://github.com/khoih-prog/FlashStorage_STM32 - #warning STM32 devices have no integrated EEPROM. Using buffered API with FlashStorage_STM32 library + + #if (MRD_GENERIC_DEBUG) + #warning STM32 devices have no integrated EEPROM. Using buffered API with FlashStorage_STM32 library + #endif + #endif #endif // #if defined(DATA_EEPROM_BASE) @@ -504,10 +577,6 @@ #endif //#if MRD_GENERIC_USE_EEPROM -#ifndef MRD_GENERIC_DEBUG - #define MRD_GENERIC_DEBUG false -#endif - /////////////////// // Default values if not specified in sketch @@ -771,6 +840,13 @@ class MultiResetDetector_Generic }; + ///////////////////////////////////////////// + + bool waitingForMRD() + { + return waitingForMultiReset; + } + ///////////////////////////////////////////// void loop() diff --git a/src/mbed_portenta/FlashIAPLimits.h b/src/mbed_portenta/FlashIAPLimits.h index 05f1cb1..f394dfd 100644 --- a/src/mbed_portenta/FlashIAPLimits.h +++ b/src/mbed_portenta/FlashIAPLimits.h @@ -14,7 +14,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/MultiResetDetector_Generic Licensed under MIT license - Version: 1.8.0 + Version: 1.8.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,7 +30,8 @@ 1.7.2 K Hoang 14/09/2021 Back to using auto LittleFS to fix bug 1.7.3 K Hoang 10/10/2021 Update `platform.ini` and `library.json` 1.8.0 K Hoang 26/01/2022 Update to be compatible with new FlashStorage libraries. Add support to more SAMD/STM32 boards -*****************************************************************************************************************************/ + 1.8.1 K Hoang 05/03/2022 Add waitingForMRD() function to signal in MRD wating period + ************************************************************************************************************************************/ #pragma once