Luca Antolini / Mbed 2 deprecated AAA_Stabilus322699_LA0020

Dependencies:   mbed QEI PID DmTftLibraryEx

Files at this revision

API Documentation at this revision

Comitter:
mverdy
Date:
Fri Aug 18 08:26:13 2017 +0000
Parent:
14:ebd89dacc807
Child:
16:4a05c050f5e0
Commit message:
Update factory reset feature with reset of eeprom and soft reset of the board; The factory reset is now also callable by pressing user button during boot

Changed in this revision

Demo/DemoApplication.h Show annotated file Show diff for this revision Revisions of this file
Display/Menu.cpp Show annotated file Show diff for this revision Revisions of this file
Peripherals/Eeprom.cpp Show annotated file Show diff for this revision Revisions of this file
Peripherals/Eeprom.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
main.h Show annotated file Show diff for this revision Revisions of this file
--- a/Demo/DemoApplication.h	Thu Aug 17 10:22:32 2017 +0000
+++ b/Demo/DemoApplication.h	Fri Aug 18 08:26:13 2017 +0000
@@ -19,7 +19,7 @@
 /*!
  * \brief Used to display firmware version on TFT (Utilities menu)
  */
-#define FIRMWARE_VERSION    ( ( char* )"Firmware Version: 170623" )
+#define FIRMWARE_VERSION    ( ( char* )"Firmware Version: 170818" )
 
 /*!
  * \brief Define range of central frequency [Hz]
--- a/Display/Menu.cpp	Thu Aug 17 10:22:32 2017 +0000
+++ b/Display/Menu.cpp	Fri Aug 18 08:26:13 2017 +0000
@@ -19,6 +19,7 @@
 #include "GpsMax7.h"
 #include "DemoApplication.h"
 #include "SX9306.h"
+#include "main.h"
 
 
 /*!
@@ -1121,8 +1122,7 @@
             case PAGE_UTILITIES:
                 if( graphObjectTouched == BTN0_BORDER )
                 {
-                    EepromSetDefaultSettings( );
-                    EepromLoadSettings( ( RadioPacketTypes_t )Eeprom.EepromData.DemoSettings.ModulationType );
+                    FactoryReset( );
                     MenuSetPage( START_PAGE );
                 }
                 else if( graphObjectTouched == BTN4_BORDER )
--- a/Peripherals/Eeprom.cpp	Thu Aug 17 10:22:32 2017 +0000
+++ b/Peripherals/Eeprom.cpp	Fri Aug 18 08:26:13 2017 +0000
@@ -599,3 +599,9 @@
 
     return memTestStruct;
 }
+
+void EepromFactoryReset( void )
+{
+    EepromSetDefaultSettings( );
+    EepromLoadSettings( ( RadioPacketTypes_t )Eeprom.EepromData.DemoSettings.ModulationType );
+}
--- a/Peripherals/Eeprom.h	Thu Aug 17 10:22:32 2017 +0000
+++ b/Peripherals/Eeprom.h	Fri Aug 18 08:26:13 2017 +0000
@@ -187,4 +187,9 @@
  */
 void EepromSetRangingDefaultSettings( void );
 
+/*!
+ * \brief Reset the EEPROM to factory state
+ */
+void EepromFactoryReset( void );
+
 #endif //EEPROM_H
--- a/main.cpp	Thu Aug 17 10:22:32 2017 +0000
+++ b/main.cpp	Fri Aug 18 08:26:13 2017 +0000
@@ -19,6 +19,7 @@
 #include "GpsMax7.h"
 #include "SX9306.h"
 #include "sx1280-hal.h"
+#include "main.h"
 
 
 /*!
@@ -26,6 +27,8 @@
  */
 DigitalOut F_CS( D6 );      // MBED description of pin
 DigitalOut SD_CS( D8 );     // MBED description of pin
+DigitalIn userButton( USER_BUTTON );
+
 
 /*!
  * \brief Specify serial datarate for UART debug output
@@ -51,6 +54,12 @@
     printf( "Starting SX1280DevKit : %s\n\r", FIRMWARE_VERSION );
 
     EepromInit( );
+
+    if( userButton == 0 )
+    {
+        FactoryReset( );
+    }
+
     InitDemoApplication( );
     MenuInit( );
     TimersInit( );
@@ -112,3 +121,9 @@
         }
     }
 }
+
+void FactoryReset( void )
+{
+    EepromFactoryReset( );
+    HAL_NVIC_SystemReset( );
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.h	Fri Aug 18 08:26:13 2017 +0000
@@ -0,0 +1,15 @@
+/*
+  ______                              _
+ / _____)             _              | |
+( (____  _____ ____ _| |_ _____  ____| |__
+ \____ \| ___ |    (_   _) ___ |/ ___)  _ \
+ _____) ) ____| | | || |_| ____( (___| | | |
+(______/|_____)_|_|_| \__)_____)\____)_| |_|
+    (C)2016 Semtech
+
+Description: EEPROM routines header
+
+Maintainer: Gregory Cristian, Gilbert Menth & Matthieu Verdy
+*/
+
+void FactoryReset( void );