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

Commit

Permalink
v1.8.1 to add waitingForDRD() function
Browse files Browse the repository at this point in the history
### Releases v1.8.1

1. Add waitingForDRD() function to signal in DRD wating period. Check [DRD is waiting for a double reset? #14](khoih-prog/ESP_DoubleResetDetector#14)
2. Add example [checkWaitingDRD](https://github.com/khoih-prog/DoubleResetDetector_Generic/tree/master/examples/checkWaitingDRD) to demo how to use the new feature.
3. Add support to `Sparkfun Pro nRF52840 Mini`
4. Update `Packages' Patches`
  • Loading branch information
khoih-prog authored Mar 6, 2022
1 parent 5216729 commit 80c550f
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 128 deletions.
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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.
Expand All @@ -50,3 +50,4 @@ There are usually some outstanding feature requests in the [existing issues list
### Sending Pull Requests

Pull Requests with changes and fixes are also welcome!

127 changes: 43 additions & 84 deletions README.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -33,6 +34,13 @@

## Changelog

### Releases v1.8.1

1. Add waitingForDRD() function to signal in DRD wating period. Check [DRD is waiting for a double reset? #14](https://github.com/khoih-prog/ESP_DoubleResetDetector/discussions/14)
2. Add example [checkWaitingDRD](https://github.com/khoih-prog/DoubleResetDetector_Generic/tree/master/examples/checkWaitingDRD) 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.
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "DoubleResetDetector_Generic",
"version": "1.8.0",
"version": "1.8.1",
"keywords": "device, control, eeprom, flashstorage-samd, flashstorage-stm32, nano-rp2040-connect, nano-33-ble, teensy, sam-due, samd, stm32, nRF52, double-reset, flashstorage, mbed-portenta, portenta-h7, portentah7, dueflashstorage, littlefs, spiffs, flashstorage-rtl8720, mbed, rpi-pico, rp2040, raspberry-pico, multi-reset, reset, detector, data",
"description": "Library to detect a double 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, Portenta_H7, RASPBERRY_PI_PICO and STM32 core v2.0.0",
"authors":
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=DoubleResetDetector_Generic
version=1.8.0
version=1.8.1
author=Khoi Hoang
maintainer=Khoi Hoang <khoih.prog@gmail.com>
license=MIT
Expand Down
152 changes: 114 additions & 38 deletions src/DoubleResetDetector_Generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/DoubleResetDetector_Generic
Licensed under MIT license
Version: 1.8.0
Version: 1.8.1
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -30,21 +30,26 @@
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 waitingForDRD() function to signal in DRD wating period
**********************************************************************************************************************************/

#pragma once

#ifndef DoubleResetDetector_Generic_H
#define DoubleResetDetector_Generic_H

#ifndef DRD_GENERIC_DEBUG
#define DRD_GENERIC_DEBUG false
#endif

#ifndef DOUBLERESETDETECTOR_GENERIC_VERSION
#define DOUBLERESETDETECTOR_GENERIC_VERSION "DoubleResetDetector_Generic v1.8.0"
#define DOUBLERESETDETECTOR_GENERIC_VERSION "DoubleResetDetector_Generic v1.8.1"

#define DOUBLERESETDETECTOR_GENERIC_VERSION_MAJOR 1
#define DOUBLERESETDETECTOR_GENERIC_VERSION_MINOR 8
#define DOUBLERESETDETECTOR_GENERIC_VERSION_PATCH 0
#define DOUBLERESETDETECTOR_GENERIC_VERSION_PATCH 1

#define DOUBLERESETDETECTOR_GENERIC_VERSION_INT 1008000
#define DOUBLERESETDETECTOR_GENERIC_VERSION_INT 1008001

#endif

Expand Down Expand Up @@ -90,7 +95,10 @@
#undef DRD_GENERIC_USE_EEPROM
#endif
#define DRD_GENERIC_USE_EEPROM false
#warning Use SAM-DUE and DueFlashStorage

#if (DRD_GENERIC_DEBUG)
#warning Use SAM-DUE and DueFlashStorage
#endif

/////////////////////////////
#elif ( defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) \
Expand All @@ -109,7 +117,10 @@
#undef DRD_GENERIC_USE_EEPROM
#endif
#define DRD_GENERIC_USE_EEPROM false
#warning Use SAMD and FlashStorage

#if (DRD_GENERIC_DEBUG)
#warning Use SAMD and FlashStorage
#endif

/////////////////////////////
#elif ( defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \
Expand All @@ -125,8 +136,11 @@
#undef DRD_GENERIC_USE_EEPROM
#endif
#define DRD_GENERIC_USE_EEPROM false
#warning Use NRF52 and LittleFS / InternalFS


#if (DRD_GENERIC_DEBUG)
#warning Use NRF52 and LittleFS / InternalFS
#endif

/////////////////////////////
#elif ( defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_ARCH_MBED) )

Expand All @@ -140,16 +154,22 @@
#endif
#define DRD_GENERIC_USE_EEPROM false

#warning Use RP2040 (such as RASPBERRY_PI_PICO) and LittleFS

#if (DRD_GENERIC_DEBUG)
#warning Use RP2040 (such as RASPBERRY_PI_PICO) and LittleFS
#endif

/////////////////////////////
#elif ( defined(ARDUINO_ARCH_RP2040) && defined(ARDUINO_ARCH_MBED) )

// For Arduino' arduino-mbed core
// To check and determine if we need to init LittleFS here
#if MBED_RP2040_INITIALIZED
#define DRD_MBED_LITTLEFS_NEED_INIT false
#warning MBED_RP2040_INITIALIZED in another place

#if (DRD_GENERIC_DEBUG)
#warning MBED_RP2040_INITIALIZED in another place
#endif

#else
// Better to delay until init done
#if defined(MBED_RP2040_INITIALIZED)
Expand All @@ -170,8 +190,10 @@
#endif
#define DRD_GENERIC_USE_EEPROM false

#warning Use MBED RP2040 (such as NANO_RP2040_CONNECT, RASPBERRY_PI_PICO) and LittleFS

#if (DRD_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) )

Expand All @@ -180,18 +202,28 @@
#endif

#if defined(CORE_CM7)
#warning Using Portenta H7 M7 core
#if (DRD_GENERIC_DEBUG)
#warning Using Portenta H7 M7 core
#endif

#define BOARD_NAME "PORTENTA_H7_M7"
#else
#warning Using Portenta H7 M4 core
#if (DRD_GENERIC_DEBUG)
#warning Using Portenta H7 M4 core
#endif

#define BOARD_NAME "PORTENTA_H7_M4"
#endif

// For Arduino' arduino-mbed core
// To check and determine if we need to init LittleFS here
#if MBED_PORTENTA_H7_INITIALIZED
#define DRD_MBED_LITTLEFS_NEED_INIT false
#warning MBED_PORTENTA_H7_INITIALIZED in another place

#if (DRD_GENERIC_DEBUG)
#warning MBED_PORTENTA_H7_INITIALIZED in another place
#endif

#else
// Better to delay until init done
#if defined(MBED_PORTENTA_H7_INITIALIZED)
Expand All @@ -212,7 +244,9 @@
#endif
#define DRD_GENERIC_USE_EEPROM false

#warning Use MBED PORTENTA_H7 and LittleFS
#if (DRD_GENERIC_DEBUG)
#warning Use MBED PORTENTA_H7 and LittleFS
#endif

/////////////////////////////
#elif ( defined(ARDUINO_ARCH_NRF52840) && defined(ARDUINO_ARCH_MBED) && defined(ARDUINO_ARDUINO_NANO33BLE) )
Expand All @@ -221,7 +255,11 @@
// To check and determine if we need to init LittleFS here
#if NANO33BLE_INITIALIZED
#define DRD_NANO33BLE_NEED_INIT false
#warning NANO33BLE_INITIALIZED in another place

#if (DRD_GENERIC_DEBUG)
#warning NANO33BLE_INITIALIZED in another place
#endif

#else
// Better to delay until init done
#if defined(NANO33BLE_INITIALIZED)
Expand All @@ -242,7 +280,9 @@
#endif
#define DRD_GENERIC_USE_EEPROM false

#warning Use MBED nRF52840 (such as Nano_33_BLE, Nano_33_BLE_Sense) and LittleFS
#if (DRD_GENERIC_DEBUG)
#warning Use MBED nRF52840 (such as Nano_33_BLE, Nano_33_BLE_Sense) and LittleFS
#endif

/////////////////////////////
#elif defined(CONFIG_PLATFORM_8721D)
Expand All @@ -255,7 +295,10 @@
#undef DRD_GENERIC_USE_EEPROM
#endif
#define DRD_GENERIC_USE_EEPROM false
#warning Use RTL8720 and FlashStorage_RTL8720

#if (DRD_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) || \
Expand All @@ -270,20 +313,35 @@
#undef DRD_GENERIC_USE_EEPROM
#endif
#define DRD_GENERIC_USE_EEPROM false
#warning Use STM32 and FlashStorage_STM32

#if (DRD_GENERIC_DEBUG)
#warning Use STM32 and FlashStorage_STM32
#endif

/////////////////////////////
#else
#if defined(CORE_TEENSY)
#warning Use TEENSY and EEPROM
#if (DRD_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 (DRD_GENERIC_DEBUG)
#warning Use AVR and EEPROM
#endif

#else
#warning Use Unknown board and EEPROM

#if (DRD_GENERIC_DEBUG)
#warning Use Unknown board and EEPROM
#endif

#endif
#endif
/////////////////////////////
Expand Down Expand Up @@ -376,8 +434,10 @@
#endif
#define DRD_FILENAME "/fs/drd.dat"

#warning DRD_MBED_LITTLEFS INITIALIZED locally in DoubleResetDetector_Generic

#if (DRD_GENERIC_DEBUG)
#warning DRD_MBED_LITTLEFS INITIALIZED locally in DoubleResetDetector_Generic
#endif

/////////////////////////////
#elif (DRD_GENERIC_USE_MBED_PORTENTA && DRD_PORTENTA_LITTLEFS_NEED_INIT)

Expand Down Expand Up @@ -411,8 +471,10 @@
#endif
#define DRD_FILENAME "/littlefs/drd.dat"

#warning DRD_PORTENTA_LITTLEFS INITIALIZED locally in DoubleResetDetector_Generic

#if (DRD_GENERIC_DEBUG)
#warning DRD_PORTENTA_LITTLEFS INITIALIZED locally in DoubleResetDetector_Generic
#endif

/////////////////////////////
#elif (DRD_GENERIC_USE_NANO33BLE && DRD_NANO33BLE_NEED_INIT)

Expand Down Expand Up @@ -466,8 +528,9 @@
#endif
#define DRD_FILENAME "/littlefs/drd.dat"

#warning DRD_NANO33BLE_LITTLEFS INITIALIZED locally in DoubleResetDetector_Generic

#if (DRD_GENERIC_DEBUG)
#warning DRD_NANO33BLE_LITTLEFS INITIALIZED locally in DoubleResetDetector_Generic
#endif

/////////////////////////////
#elif DRD_GENERIC_USE_STM32
Expand All @@ -477,7 +540,11 @@
#if defined(DATA_EEPROM_BASE)
// For STM32 devices having integrated EEPROM.
#include <EEPROM.h>
#warning STM32 devices have integrated EEPROM. Not using buffered API.

#if (DRD_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
Expand All @@ -489,10 +556,18 @@
*/
#if ( defined(STM32F1xx) || defined(STM32F3xx) )
#include <FlashStorage_STM32F1.h> // https://github.com/khoih-prog/FlashStorage_STM32
#warning STM32F1/F3 devices have no integrated EEPROM. Using buffered API with FlashStorage_STM32F1 library

#if (DRD_GENERIC_DEBUG)
#warning STM32F1/F3 devices have no integrated EEPROM. Using buffered API with FlashStorage_STM32F1 library
#endif

#else
#include <FlashStorage_STM32.h> // https://github.com/khoih-prog/FlashStorage_STM32
#warning STM32 devices have no integrated EEPROM. Using buffered API with FlashStorage_STM32 library

#if (DRD_GENERIC_DEBUG)
#warning STM32 devices have no integrated EEPROM. Using buffered API with FlashStorage_STM32 library
#endif

#endif
#endif // #if defined(DATA_EEPROM_BASE)

Expand All @@ -508,10 +583,6 @@

/////////////////////////////////////////////

#ifndef DRD_GENERIC_DEBUG
#define DRD_GENERIC_DEBUG false
#endif

#define DOUBLERESETDETECTOR_GENERIC_FLAG_SET 0xD0D01234
#define DOUBLERESETDETECTOR_GENERIC_FLAG_CLEAR 0xD0D04321

Expand Down Expand Up @@ -740,6 +811,11 @@ class DoubleResetDetector_Generic

};

bool waitingForDRD()
{
return waitingForDoubleReset;
}

/////////////////////////////////////////////

void loop()
Expand Down
Loading

0 comments on commit 80c550f

Please sign in to comment.