1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

changed pios watchdog from 8-bit to 16-bit ms capability, plus moved the .h file from the .c folder into the inc folder

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1466 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2010-08-30 16:29:36 +00:00 committed by pip
parent e15a12329c
commit ba5f1b37ee
2 changed files with 12 additions and 11 deletions

View File

@ -54,19 +54,20 @@
* @param[in] delayMs The delay period in ms
* @returns Maximum recommended delay between updates
*/
uint8_t PIOS_WDG_Init( uint8_t delayMs )
uint16_t PIOS_WDG_Init(uint16_t delayMs)
{
uint16_t delay;
delay = 60 / 16 * delayMs;
if( delay > 0xfff )
delay = 0xfff;
uint32_t delay = (60ul * delayMs) / 16;
if (delay > 0xfff) delay = 0xfff;
DBGMCU_Config(DBGMCU_IWDG_STOP, ENABLE); // make the watchdog stop counting in debug mode
IWDG_WriteAccessCmd( IWDG_WriteAccess_Enable );
IWDG_SetPrescaler( IWDG_Prescaler_16 );
IWDG_SetReload( delay );
IWDG_ReloadCounter();
IWDG_Enable();
return delay / (60 / 16) * .75;
IWDG_Enable();
// return delay / (60 / 16) * .75f;
return (((delay * 16) / 60) * .75f);
}
/**
@ -74,7 +75,7 @@ uint8_t PIOS_WDG_Init( uint8_t delayMs )
*
* This function must be called at the appropriate delay to prevent a reset event occuring
*/
void PIOS_WDG_Clear()
void PIOS_WDG_Clear(void)
{
IWDG_ReloadCounter();
}

View File

@ -31,7 +31,7 @@
#ifndef PIOS_WDG
#define PIOS_WDG
uint8_t PIOS_WDG_Init( uint8_t delayMs );
void PIOS_WDG_Clear();
uint16_t PIOS_WDG_Init(uint16_t delayMs);
void PIOS_WDG_Clear(void);
#endif
#endif