Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BufferedSerial FatFileSystemCpp mbed
Diff: main.cpp
- Revision:
- 12:06050debf014
- Parent:
- 11:ef7f6591b776
- Child:
- 14:76083dc18b0d
--- a/main.cpp Fri Feb 19 15:55:25 2021 +0000
+++ b/main.cpp Fri Feb 19 16:53:27 2021 +0000
@@ -4,7 +4,7 @@
#include "LTCApp.h"
- MSCFileSystem msc("msc");
+MSCFileSystem msc("msc");
//USBHostMSD msd("msc");
BufferedSerial pc(USBTX, USBRX);
@@ -35,6 +35,7 @@
// clock to time everything with
Timer inputTimer;
+Timeout resetTimeout;
float logButtonDownTime;
float logButtonUpTime;
@@ -205,6 +206,10 @@
NewFramePulse = true;
}
+void OnResetTimeout() {
+ NVIC_SystemReset();
+ }
+
int main()
{
@@ -303,6 +308,7 @@
if (logButtonLastState != logButton) {
if (logButton) { // pressed
logButtonDownTime = inputTimer.read();
+ resetTimeout.attach(callback(&OnResetTimeout),10);
if (logging) {
logLED = LED_OFF;
logging=false;
@@ -316,6 +322,7 @@
}
} else { // released
logButtonUpTime = inputTimer.read();
+ resetTimeout.attach(NULL,0);
}
logButtonLastState = logButton;
}