1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

PIOS/WDG: Add back the returned delay for code that wants to clear WDG more

rarely

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2403 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2011-01-13 19:01:33 +00:00 committed by peabody124
parent 86fc4d2d1c
commit 07798bb2db
2 changed files with 5 additions and 6 deletions

View File

@ -55,16 +55,14 @@ static struct wdg_configuration {
* set in the watchdog assumes the nominal clock rate, but the delay for FreeRTOS
* to use is 75% of the minimal delay.
*
* @param[in] delayMs The delay period in ms
* @returns Maximum recommended delay between updates
* @returns Maximum recommended delay between updates based on PIOS_WATCHDOG_TIMEOUT constant
*/
void PIOS_WDG_Init()
uint16_t PIOS_WDG_Init()
{
#if defined(PIOS_INCLUDE_WDG)
uint16_t delay = ((uint32_t) PIOS_WATCHDOG_TIMEOUT * 60) / 16;
if (delay > 0x0fff)
delay = 0x0fff;
#if defined(PIOS_INCLUDE_WDG)
DBGMCU_Config(DBGMCU_IWDG_STOP, ENABLE); // make the watchdog stop counting in debug mode
IWDG_WriteAccessCmd(IWDG_WriteAccess_Enable);
IWDG_SetPrescaler(IWDG_Prescaler_16);
@ -77,6 +75,7 @@ void PIOS_WDG_Init()
wdg_configuration.bootup_flags = BKP_ReadBackupRegister(PIOS_WDG_REGISTER);
#endif
return delay;
}
/**

View File

@ -31,7 +31,7 @@
#ifndef PIOS_WDG
#define PIOS_WDG
void PIOS_WDG_Init();
uint16_t PIOS_WDG_Init();
bool PIOS_WDG_RegisterFlag(uint16_t flag_requested);
bool PIOS_WDG_UpdateFlag(uint16_t flag);
uint16_t PIOS_WDG_GetBootupFlags();