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.
Dependents: test-lpc1768 oldheating gps motorhome ... more
reset/reset.c
- Committer:
- andrewboyson
- Date:
- 2019-05-08
- Revision:
- 49:d056e2c5c4ee
- Child:
- 50:e90c6aaa2645
File content as of revision 49:d056e2c5c4ee:
#include <stdio.h>
#include <string.h>
#include "rsid.h"
#include "restart.h"
#include "watchdog.h"
#include "led.h"
#include "mstimer.h"
bool ResetAccepted = false;
bool ResetWasPushButton()
{
return RsidExtr && RestartGetLastCause() == RESTART_CAUSE_RESET_BUTTON;
}
void ResetInit()
{
RsidInit();
RestartInit();
WatchdogInit();
}
void ResetMain()
{
//Feed the watchdog
WatchdogMain();
//Flash an led
bool doFlash = true;
if (ResetAccepted) doFlash = false;
if (RsidExtr)
{
if (RestartGetLastCause() == RESTART_CAUSE_RESET_BUTTON ) doFlash = false;
if (RestartGetLastCause() == RESTART_CAUSE_SOFTWARE_RESET) doFlash = false;
}
static uint32_t ledFlashTimer = 0;
if (doFlash)
{
if (MsTimerRepetitive(&ledFlashTimer, 100)) Led4Tgl();
}
else
{
Led4Set(false);
}
}