Watchdog.h, WatchdogCC26XX.c, WatchdogCC26XX.h to your project, and add
$SRC_COMMON$/services/src/watchdog to your project include path.
2.In CC2650DK_5XD.h(Select what platform you use) add below code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* @def CC2650DK_5XD_Watchdog | |
* @brief Enum of Watchdog on the board | |
*/ | |
typedef enum CC2650DK_5XD_WatchdogName { | |
CC2650DK_5XD_WATCHDOG0 = 0, | |
CC2650DK_5XD_WATCHDOGCOUNT | |
} CC2650DK_5XD_WatchdogName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Watchdog.h" | |
#include "WatchdogCC26XX.h" | |
WatchdogCC26XX_Object watchdogCC26XXObjects[CC2650DK_5XD_WATCHDOGCOUNT]; | |
const WatchdogCC26XX_HWAttrs watchdogCC26XXHwAttrs[] = { | |
{ | |
.baseAddr = WDT_BASE, | |
.intNum = INT_WDT_IRQ, | |
} | |
}; | |
const Watchdog_Config Watchdog_config[] = { | |
{ &WatchdogCC26XX_fxnTable, &watchdogCC26XXObjects[0], &watchdogCC26XXHwAttrs[0] }, | |
{ NULL, NULL, NULL }, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ti/drivers/Watchdog.h> | |
void watchdogCallback(UArg handle) | |
{ | |
/* WDT Timeout handler*/ | |
} | |
Watchdog_Handle wdthandle; | |
Watchdog_Params wdtparams; | |
uint32_t tickValue; | |
Board_initWatchdog(); | |
Watchdog_Params_init(&wdtparams); | |
wdtparams.callbackFxn = watchdogCallback; | |
wdthandle = Watchdog_open(CC2650DK_5XD_WATCHDOG0, &wdtparams); | |
// set timeout period to 500 ms | |
tickValue = Watchdog_convertMsToTicks(wdthandle, 500); | |
Watchdog_setReload(wdthandle, tickValue); |
Ref:
1.RTOS/CC2640: How to set CC2640 watchdog with TIRTOS 2.13
2.WatchdogCC26XX.h File Reference
3.CC2640 看门狗
4.http://blog.csdn.net/zzfenglin/article/details/52253536